Part Number Hot Search : 
AN1N958D P6KE100C SPLCGXX HT48R0 022284 UPA1556A ECG008 CMDZ13V
Product Description
Full Text Search
 

To Download AT91X40 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  1 features ? incorporates the arm7tdmi ? arm ? thumb ? processor core ? high-performance 32-bit risc architecture ? high-density 16-bit instruction set ? leader in mips/watt ? embedded ice (in-circuit emulation)  on-chip sram and/or rom ?32-bitdatabus ? single-clock cycle access  fully programmable external bus interface (ebi) ? maximum external address space of 64m bytes ? upto8chipselects ? software programmable 8/16-bit external databus  8-level priority, individually maskable, vectored interrupt controller ? 4 external interrupts, including a high-priority low-latency interrupt request  32 programmable i/o lines  3-channel 16-bit timer/counter ? 3 external clock inputs ? 2 multi-purpose i/o pins per channel  2usarts ? 2 dedicated peripheral data controller (pdc) channels per usart  programmable watchdog timer  advanced power-saving features ? cpu and peripheral can be deactivated individually  available in a 100-lead tqfp package description the AT91X40 series is a subset of the atmel at91 16/32-bit microcontroller family, which is based on the arm7tdmi processor core. this processor has a high-perfor- mance 32-bit risc architecture with a high-density 16-bit instruction set and very low power consumption. in addition, a large number of internally banked registers result in very fast exception handling, making the device ideal for real-time control applications. the AT91X40 series features a direct connection to off-chip memory, including flash, through the fully programmable external bus interface (ebi). an eight-level priority vectored interrupt controller, in conjunction with the peripheral data controller signifi- cantly improve the real-time performance of the device. the devices are manufactured using atmel?s high-density cmos technology. by com- bining the arm7tdmi processor core with on-chip high-speed memory and a wide range of peripheral functions on a monolithic chip, the atmel AT91X40 series is a fam- ily of powerful microcontrollers that offer a flexible, cost-effective solution to many compute-intensive embedded control applications. microcontroller primary sram bank secondary sram bank rom at91m40800 8k bytes ? ? at91r40807 8k bytes 128k bytes ? at91m40807 8k bytes ? 128k bytes at91r40008 256k bytes ? ? at91 arm ? thumb ? microcontrollers at91m40800 at91r40807 at91m40807 at91r40008 rev. 1354d?atarm?05/02
2 AT91X40 series 1354d?atarm?05/02 pin configuration figure 1. AT91X40 series pinout (top view) p21/txd1/ntri p20/sck1 p19 p18 p17 p16 p15/rxd0 p14/txd0 p13/sck0 p12/fiq gnd p11/irq2 p10/irq1 vddio vddcore p9/irq0 p8/tiob2 p7/tioa2 p6/tclk2 p5/tiob1 p4/tioa1 p3/tclk1 gnd gnd p2/tiob0 p1/tioa0 p0/tclk0 d15 d14 d13 d12 vddio d11 d10 d9 d8 d7 d6 d5 gnd d4 d3 d2 d1 d0 p31/a23/cs4 p30/a22/cs5 vddio vddcore p29/a21/cs6 p22/rxd1 nwr1/nub gnd nrst nwdovf vddio mcki p23 p24/bms p25/mcko gnd gnd tms tdo tck nrd/noe nwr0/nwe vddcore vddio nwait ncs0 ncs1 p26/ncs2 p27/ncs3 a0/nlb a1 a2 a2 a3 a4 a5 a6 a7 vddio a8 a9 a10 a11 a12 a13 a14 gnd gnd a15 a16 a17 a18 a19 p28/a20/cs7 gnd 1 25 100-lead tqfp 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 16 17 18 19 20 21 22 23 24 26 50 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 75 51 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 100 76 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 tdi
3 AT91X40 series 1354d ? atarm ? 05/02 table 1 . AT91X40 series pin description module name function type active level comments ebi a0 - a23 address bus output ? all valid after reset d0 - d15 data bus i/o ? ncs0 - ncs3 chip select output low cs4 - cs7 chip select output high a23 - a20 after reset nwr0 lower byte 0 write signal output low used in byte write option nwr1 upper byte 1 write signal output low used in byte write option nrd read signal output low used in byte write option nwe write enable output low used in byte select option noe output enable output low used in byte select option nub upper byte select output low used in byte select option nlb lower byte select output low used in byte select option nwait wait input input low bms boot mode select input ? sampled during reset aic fiq fast interrupt request input ? pio-controlled after reset irq0 - irq2 external interrupt request input ? pio-controlled after reset tc tclk0 - tclk2 timer external clock input ? pio-controlled after reset tioa0 - tioa2 multipurpose timer i/o pin a i/o ? pio-controlled after reset tiob0 - tiob2 multipurpose timer i/o pin b i/o ? pio-controlled after reset usart sck0 - sck1 external serial clock i/o ? pio-controlled after reset txd0 - txd1 transmit data output output ? pio-controlled after reset rxd0 - rxd1 receive data input input ? pio-controlled after reset pio p0 - p31 parallel io line i/o ? wd nwdovf watchdog overflow output low open-drain clock mcki master clock input input ? schmidt trigger mcko master clock output output ? reset nrst hardware reset input input low schmidt trigger ntri tri-state mode select input low sampled during reset ice tms test mode select input ? schmidt trigger, internal pull-up tdi test data input input ? schmidt trigger, internal pull-up tdo test data output output ? tck test clock input ? schmidt trigger, internal pull-up power vddio i/o power power ? vddcore core power power ? gnd ground ground ?
4 AT91X40 series 1354d ? atarm ? 05/02 block diagram figure 2. AT91X40 series arm7tdmi core embedded ice reset ebi: external bus interface asb controller clock aic: advanced interrupt controller amba bridge ebi user interface tc: timer counter tc0 tc1 tc2 usart0 usart1 2 pdc channels 2 pdc channels pio: parallel i/o controller ps: power saving chip id wd: watchdog timer apb asb p i o p i o nrst d0-d15 a1-a19 a0/nlb nrd/noe nwr0/nwe nwr1/nub nwait ncs0 ncs1 p26/ncs2 p27/ncs3 p28/a20/cs7 p29/a21/cs6 p30/a22/cs5 p31/a23/cs4 p0/tclk0 p3/tclk1 p6/tclk2 p1/tioa0 p2/tiob0 p4/tioa1 p5/tiob1 p7/tioa2 p8/tiob2 nwdovf tms tdo tdi tck mcki p25/mcko p12/fiq p9/irq0 p10/irq1 p11/irq2 p13/sck0 p14/txd0 p15/rxd0 p20/sck1 p21/txd1/ntri p22/rxd1 p16 p17 p18 p19 p23 p24/bms ram rom or extended sram
5 AT91X40 series 1354d ? atarm ? 05/02 architectural overview the AT91X40 series microcontrollers integrate an arm7tdmi with its embedded ice interface, memories and peripherals. the series ? architecture consists of two main buses, the advanced system bus (asb) and the advanced peripheral bus (apb). designed for maximum performance and controlled by the memory controller, the asb interfaces the arm7tdmi processor with the on-chip 32-bit memories, the external bus interface (ebi) and the amba ? bridge. the amba bridge drives the apb, which is designed for accesses to on-chip peripherals and optimized for low-power consumption. the AT91X40 series microcontrollers implement the ice port of the arm7tdmi proces- sor on dedicated pins, offering a complete, low-cost and easy-to-use debug solution for target debugging. memories the AT91X40 series microcontrollers embed up to 256k bytes of internal sram, and up to 128k bytes of rom. the internal memories are directly connected to the 32-bit data bus and are single-cycle accessible. this provides maximum performance of 0.9 mips/mhz by using the arm instruction set of the processor, minimizing system power consumption and improving the performance of separate memory solutions. the AT91X40 series microcontrollers feature an external bus interface (ebi), which enables connection of external memories and application-specific peripherals. the ebi supports 8- or 16-bit devices and can use two 8-bit devices to emulate a single 16-bit device. the ebi implements the early read protocol, enabling faster memory accesses than standard memory interfaces. peripherals the AT91X40 series microcontrollers integrate several peripherals, which are classified as system or user peripherals. all on-chip peripherals are 32-bit accessible by the amba bridge, and can be programmed with a minimum number of instructions. the peripheral register set is composed of control, mode, data, status and enable/dis- able/status registers. an on-chip peripheral data controller (pdc) transfers data between the on-chip usarts and on- and off-chip memories address space without processor intervention. most importantly, the pdc removes the processor interrupt handling overhead, making it possible to transfer up to 64k continuous bytes without reprogramming the start address, thus increasing the performance of the microcontroller, and reducing the power consumption. system peripherals the external bus interface (ebi) controls the external memory or devices via an 8-bit or 16-bit data bus, and is programmed through the advanced peripheral bus (apb). each chip select line has its own programming register. the power saving (ps) module implements the idle mode (arm7tdmi core clock stopped until the next interrupt) and enables the user to adapt the power consumption of the microcontroller to application requirements (independent peripheral clock control). the advanced interrupt controller (aic) controls the internal sources from the internal peripherals and the four external interrupt lines (including the fiq) to provide an inter- rupt and/or fast interrupt request to the arm7tdmi. it integrates an 8-level priority controller, and, using the auto-vectoring feature, reduces the interrupt latency time. the parallel input/output controller (pio) controls up to 32 i/o lines. it enables the user to select specific pins for on-chip peripheral input/output functions, and general-purpose input/output signal pins. the pio controller can be programmed to detect an interrupt on a signal change from each line.
6 AT91X40 series 1354d ? atarm ? 05/02 the watchdog (wd) can be used to prevent system lock-up if the software becomes trapped in a deadlock. the special function (sf) module integrates the chip id, the reset status and the pro- tect registers. user peripherals two usarts, independently configurable, enable communication at a high baud rate in synchronous or asynchronous mode. the format includes start, stop and parity bits and up to 8 data bits. each usart also features a timeout and a time guard register, facil- itating the use of the two dedicated peripheral data controller (pdc) channels. the 3-channel, 16-bit timer counter (tc) is highly-programmable and supports capture or waveform modes. each tc channel can be programmed to measure or generate dif- ferent kinds of waves, and can detect and control two input/output signals. the tc also has 3 external clock signals.
7 AT91X40 series 1354d ? atarm ? 05/02 associated documentation table 2 . associated documentation product information document title at91m40800 internal architecture of processor arm/thumb instruction sets embedded in-circuit-emulator arm7tdmi (thumb) datasheet pinout mechanical characteristics ordering information at91m40800 summary datasheet timings dc characteristics at91m40800 electrical characteristics at91r40807 internal architecture of processor arm/thumb instruction sets embedded in-circuit-emulator arm7tdmi (thumb) datasheet pinout mechanical characteristics ordering information at91r40807 summary datasheet timings dc characteristics at91r40807 electrical characteristics at91m40807 internal architecture of processor arm/thumb instruction sets embedded in-circuit-emulator arm7tdmi (thumb) datasheet pinout mechanical characteristics ordering information at91m40807 summary datasheet timings dc characteristics at91m40807 electrical characteristics at91r40008 internal architecture of processor arm/thumb instruction sets embedded in-circuit-emulator arm7tdmi (thumb) datasheet pinout mechanical characteristics ordering information at91r40008 summary datasheet timings dc characteristics at91r40008 electrical characteristics
8 AT91X40 series 1354d ? atarm ? 05/02 product overview power supply the AT91X40 series microcontrollers have two types of power supply pins - vddio and vddcore. however, the at91m40800, the at91m40807 and the at91r40807 have single-supply vdd, vddio and vddcore pins that have to be tied to the same volt- age. for further details on power supplies and acceptable voltage range on vdd, vddio and vddcore, refer to the product summary datasheet or the product electri- cal characteristics datasheet. input/output considerations the at91m40807, the at91r40807 and the at91r40008 accept voltage levels up to their power supply limit on the pads. the at91m40800 microcontroller i/o pads are 5v-tolerant, enabling it to interface with external 5v devices without any additional components. 5v-tolerant means that the at91m40800 accepts 5v (3v) on the inputs even if it is powered at 3v (2v). refer to the at91m40800 electrical characteristics datasheet for further details. after the reset, the peripheral i/os are initialized as inputs to provide the user with maxi- mum flexibility. it is recommended that in any application phase, the inputs to the AT91X40 series microcontroller be held at valid logic levels to minimize the power consumption. master clock the AT91X40 series microcontrollers have a fully static design and work on the master clock (mck), provided on the mcki pin from an external source. the master clock is also provided as an output of the device on the pin mcko, which is multiplexed with a general-purpose i/o line. while nrst is active, the mcko stays low. after the reset, the mcko is valid and outputs an image of the mck signal. the pio controller must be programmed to use this pin as standard i/o line. reset reset restores the default states of the user interface registers (defined in the user inter- face of each peripheral), and forces the arm7tdmi to perform the next instruction fetch from address zero. except for the program counter the arm7tdmi registers do not have defined reset states. nrst pin nrst is active low-level input. it is asserted asynchronously, but exit from reset is syn- chronized internally to the mck. the signal presented on mck must be active within the specification for a minimum of 10 clock cycles up to the rising edge of nrst, to ensure correct operation. the first processor fetch occurs 80 clock cycles after the rising edge of nrst. watchdog reset the watchdog can be programmed to generate an internal reset. in this case, the reset has the same effect as the nrst pin assertion, but the pins bms and ntri are not sampled. boot mode and tri-state mode are not updated. if the nrst pin is asserted and the watchdog triggers the internal reset, the nrst pin has priority. emulation function tri-state mode the AT91X40 series provides a tri-state mode, which is used for debug purposes. this enables the connection of an emulator probe to an application board without having to desolder the device from the target board. in tri-state mode, all the output pin drivers of the AT91X40 series microcontroller are disabled.
9 AT91X40 series 1354d ? atarm ? 05/02 to enter tri-state mode, the pin ntri must be held low during the last 10 clock cycles before the rising edge of nrst. for normal operation, the pin ntri must be held high during reset, by a resistor of up to 400k ohm. ntri is multiplexed with i/o line p21 and usart 1 serial data transmit line txd1. standard rs-232 drivers generally contain internal 400k ohm pull-up resistors. if txd1 is connected to a device not including this pull-up, the user must make sure that a high level is tied on ntri while nrst is asserted. jtag/ice debug arm standard embedded in-circuit emulation is supported via the jtag/ice port. the pins tdi, tdo, tck and tms are dedicated to this debug function and can be con- nected to a host computer via the external ice interface. in ice debug mode, the arm7tdmi core responds with a non-jtag chip id that identi- fies the microcontroller. this is not fully ieee1149.1 compliant. memory controller the arm7tdmi processor address space is 4g bytes. the memory controller decodes the internal 32-bit address bus and defines three address spaces:  internal memories in the four lowest megabytes  middle space reserved for the external devices (memory or peripherals) controlled by the ebi  internal peripherals in the four highest megabytes in any of these address spaces, the arm7tdmi operates in little-endian mode only. internal memories the AT91X40 series microcontrollers integrate one or two banks of internal static sram and/or one bank of rom. all internal memories are 32 bits wide and single-clock cycle accessible. byte (8-bit), halfword (16-bit) or word (32-bit) accesses are supported and are executed within one cycle. fetching thumb or arm instructions is supported and internal memory can store twice as many thumb instructions as arm ones. all the AT91X40 series microcontrollers integrate a primary 8-kbyte or 256-kbyte sram bank, accessible at address 0x0 (after the remap). the at91r40807 integrates a secondary sram memory bank of 128k bytes at address 0x10 0000. this secondary bank can be used to emulate the rom of the at91m40807. the at91m40807 microcontroller integrates 128k bytes of internal rom at address 0x10 0000. it offers a reduced-cost option of the at91r40807 for high-volume applica- tions in which the software is stable. using internal memories the primary ram bank is always mapped at address 0x30 0000 before remap and at address 0x0 after the remap, allowing arm7tdmi exception vectors to be modified by the software. making the ram bank accessible before remap allows the user to copy arm exception vectors and boot code into the bank prior to remap. the rest of the bank can be used for stack allocation to speed up context saving and restoration, or as data and program storage for critical algorithms. placing the sram on-chip and using a 32-bit data bus bandwidth maximizes microcon- troller performance while minimizing system power consumption. the 32-bit bus optimizes use of the arm instruction set and offers the ability to process data wider than 16 bits, thus making optimal use of the arm7tdmi advanced performance. the capability to update application software dynamically in an internal sram bank adds an extra dimension to the AT91X40 series microcontrollers.
10 AT91X40 series 1354d ? atarm ? 05/02 rom emulation the at91r40807 provides an ideal means of emulating the rom version at91m40807. the secondary sram bank of the at91r40807 is mapped to the same address as the rom of the at91m40807. it is write-protected after a reset; writing 0x1 in the memory mode register of the special function module can disable this protection. at system power-up, the code is downloaded from an external non-volatile memory or through a debugger to the on-chip secondary sram bank of the at91r40807. after the secondary sram bank write-protection is enabled, the application is in the same envi- ronment as though it were running on an at91m40807. boot mode select the arm reset vector is at address 0x0. after the nrst line is released, the arm7tdmi executes the instruction stored at this address. this means that this address must be mapped in non-volatile memory after the reset. the input level on the bms pin during the last 10 clock cycles before the rising edge of the nrst selects the type of boot memory. the boot mode depends on bms and whether or not the AT91X40 series microcontroller has on-chip rom or extended sram (see table 3). the at91r40807 supports boot in on-chip extended sram, for the purpose of emulat- ing rom versions. in this case, the microcontroller must first boot from external non- volatile memory, and ensure that a valid program is downloaded in the on-chip extended sram. then, the nrst must be reasserted by external circuitry after the level on the pin bms is changed. the pin bms is multiplexed with the i/o line p24 that can be programmed after reset like any standard pio line. remap command the arm vectors (reset, abort, data abort, prefetch abort, undefined instruction, interrupt, fast interrupt) are mapped from address 0x0 to address 0x20. in order to allow these vectors to be redefined dynamically by the software, the AT91X40 series microcontrollers use a remap command that enables switching between the boot mem- ory and the internal primary sram bank addresses. the remap command is accessible through the ebi user interface, by writing one in rcb of ebi_rcr (remap control register). performing a remap command is mandatory if access to the other external devices (connected to chip selects 1 to 7) is required. the remap operation can only be changed back by an internal reset or an nrst assertion. abort control the abort signal providing a data abort or a prefetch abort exception to the arm7tdmi is asserted in the following cases:  when accessing an undefined address in the ebi address space  when writing to a write-protected internal memory area on the at91r40807 ta ble 3. boot mode select bms product boot memory 1 at91m40800 external 8-bit memory on ncs0 at91r40807 internal 32-bit extended sram at91m40807 internal 32-bit rom at91r40008 external 8-bit memory on ncs0 0 all external 16-bit memory on ncs0
11 AT91X40 series 1354d ? atarm ? 05/02 no abort is generated when reading the internal memory or by accessing the internal peripheral, whether the address is defined or not. when a write-protected area is accessed, the memory controller detects it and gener- ates an abort but does not cancel the access. external bus interface the external bus interface handles the accesses between addresses 0x0040 0000 and 0xffc0 0000. it generates the signals that control access to the external devices, and can be configured from eight 1m byte banks up to four 16m bytes banks. it supports byte, half-word and word aligned accesses. for each of these banks, the user can program:  number of wait states  number of data float times (wait time after the access is finished to prevent any bus contention in case the device is too long in releasing the bus)  data bus width (8-bit or 16-bit)  with a 16-bit wide data bus, the user can program the ebi to control one 16-bit device (byte access select mode) or two 8-bit devices in parallel that emulate a 16- bit memory (byte write access mode). the external bus interface features also the early read protocol, configurable for all the devices, that significantly reduces access time requirements on an external device in the case of single clock cycle access. peripherals the AT91X40 series ? peripherals are connected to the 32-bit wide advanced peripheral bus. peripheral registers are only word accessible ? byte and half-word accesses are not supported. if a byte or a half-word access is attempted, the memory controller auto- matically masks the lowest address bits and generates a word access. each peripheral has a 16-kbyte address space allocated (the aic only has a 4-kbyte address space). peripheral registers the following registers are common to all peripherals:  control register ? write only register that triggers a command when a one is written to the corresponding position at the appropriate address. writing a zero has no effect.  mode register ? read/write register that defines the configuration of the peripheral. usually has a value of 0x0 after a reset.  data registers ? read and/or write register that enables the exchange of data between the processor and the peripheral.  status register ? read only register that returns the status of the peripheral.  enable/disable/status registers are shadow command registers. writing a one in the enable register sets the corresponding bit in the status register. writing a one in the disable register resets the corresponding bit and the result can be read in the status register. writing a bit to zero has no effect. this register access method maximizes the efficiency of bit manipulation, and enables modification of a register with a single non-interruptible instruction, replacing the costly read-modify-write operation. unused bits in the peripheral registers are shown as ? ? ? and must be written at 0 for upward compatibility. these bits read 0.
12 AT91X40 series 1354d ? atarm ? 05/02 peripheral interrupt control the interrupt control of each peripheral is controlled from the status register using the interrupt mask. the status register bits are anded to their corresponding interrupt mask bits and the result is then ored to generate the interrupt source signal to the advanced interrupt controller. the interrupt mask is read in the interrupt mask register and is modified with the inter- rupt enable register and the interrupt disable register. the enable/disable/status (or mask) makes it possible to enable or disable peripheral interrupt sources with a non- interruptible single instruction. this eliminates the need for interrupt masking at the aic or core level in real-time and multi-tasking systems. peripheral data controller the AT91X40 series microcontroller has a 4-channel pdc dedicated to the two on-chip usarts. one pdc channel is dedicated to the receiver and one to the transmitter of each usart. the user interface of a pdc channel is integrated in the memory space of each usart. it contains a 32-bit address pointer register (rpr or tpr) and a 16-bit transfer counter register (rcr or tcr). when the programmed number of transfers are per- formed, a status bit indicating the end of transfer is set in the usart status register and an interrupt can be generated. system peripherals ps: power-saving the power-saving feature optimizes power consumption, enabling the software to stop the arm7tdmi clock (idle mode) and restarting it when the module receives an inter- rupt (or reset). it also enables on-chip peripheral clocks to be enabled and disabled individually, matching power consumption and application needs. aic: advanced interrupt controller the aic has an 8-level priority, individually maskable, vectored interrupt controller, and drives the nirq and nfiq pins of the arm7tdmi from:  the external fast interrupt line (fiq)  the three external interrupt request lines (irq0 - irq2)  the interrupt signals from the on-chip peripherals the aic is extensively programmable, offering maximum flexibility, and its vectoring fea- tures reduce the real-time overhead in handling interrupts. the aic also features a spurious vector, which reduces spurious interrupt handling to a minimum, and a protect mode that facilitates the debug capabilities. pio: parallel io controller the AT91X40 series has 32 programmable i/o lines. six pins are dedicated as general- purpose i/o pins. other i/o lines are multiplexed with an external signal of a peripheral to optimize the use of available package pins. the pio controller enables generation of an interrupt on input change and insertion of a simple input glitch filter on any of the pio pins. wd: watchdog the watchdog is built around a 16-bit counter, and is used to prevent system lock-up if the software becomes trapped in a deadlock. it can generate an internal reset or inter- rupt, or assert an active level on the dedicated pin nwdovf. all programming registers are password-protected to prevent unintentional programming.
13 AT91X40 series 1354d ? atarm ? 05/02 sf: special function the AT91X40 series provides registers that implement the following special functions.  chip identification  reset status  protect mode  write protection for the at91r40807 internal 128-kbyte memory
14 AT91X40 series 1354d ? atarm ? 05/02 user peripherals usart: universal synchronous/ asynchronous receiver transmitter the AT91X40 series provides two identical, full-duplex, universal synchronous/asyn- chronous receiver/transmitters. each usart has its own baud rate generator, and two dedicated peripheral data con- troller channels. the data format includes a start bit, up to 8 data bits, an optional programmable parity bit and up to 2 stop bits. the usart also features a receiver timeout register, facilitating variable length frame support when it is working with the pdc, and a time guard register, used when interfac- ing with slow remote equipment. tc: timer counter the AT91X40 series features a timer counter block that includes three identical 16-bit timer counter channels. each channel can be independently programmed to perform a wide range of functions, including frequency measurement, event counting, interval measurement, pulse generation, delay timing and pulse-width modulation. the timer counter can be used in capture or waveform mode, and all three counter channels can be started simultaneously and chained together.
15 AT91X40 series 1354d ? atarm ? 05/02 memory map figure 3. at91m40800/r40008 memory map before and after the remap command after before address function size abort control 0xffffffff 0xffc00000 0xffbfffff 0x00400000 0x003fffff 0x00300000 0x002fffff 0x00200000 0x001fffff 0x00100000 0x000fffff 0x00000000 on-chip peripherals reserved on-chip primary ram bank reserved on-chip device reserved on-chip device external devices selected by ncs0 4m bytes 1m byte 1m byte 1m byte 1m byte no no no no no ye s address function size abort control 0xffffffff 0xffc00000 0xffbfffff 0x00400000 0x003fffff 0x00300000 0x002fffff 0x00200000 0x001fffff 0x00100000 0x000fffff 0x00000000 on-chip peripherals external devices (up to 8) reserved reserved on-chip device reserved on-chip device on-chip primary ram bank 4m bytes up to 8 devices programmable page size 1, 4, 16, 64m bytes 1m byte 1m byte 1m byte no ye s no no no 1m byte no
16 AT91X40 series 1354d ? atarm ? 05/02 figure 4. at91r40807/m40807 before and after the remap command address function size abort control 0xffffffff 0xffc00000 0xffbfffff 0x00400000 0x003fffff 0x00300000 0x002fffff 0x00200000 0x001fffff 0x00100000 0x000fffff 0x00000000 on-chip peripherals external devices (up to 8) reserved reserved on-chip device on-chip rom or secondary ram bank on-chip primary ram bank 4m bytes up to 8 devices programmable page size 1, 4, 16, 64m bytes 1m byte 1m byte 1m byte no ye s no ye s (at91r40807, if write-protect feature is enabled) no 1m byte no address function size abort control 0xffffffff 0xffc00000 0xffbfffff 0x00400000 0x003fffff 0x00300000 0x002fffff 0x00200000 0x001fffff 0x00100000 0x000fffff 0x00000000 on-chip peripherals reserved on-chip primary ram bank reserved on-chip device on-chip rom or secondary ram bank external device selected by ncs0 or on-chip rom or secondary ram bank 4m bytes 1m byte 1m byte 1m byte 1m byte no no no ye s (at91r40807, if write-protect feature is enabled) no ye s after before
17 AT91X40 series 1354d ? atarm ? 05/02 peripheral memory map figure 5. peripheral memory map address peripheral peripheral name size 0xffffffff 0xfffff000 0xffffbfff 0xffff8000 0xffff7fff 0xffff4000 0xffff3fff 0xffff0000 0xfffe3fff 0xfffe0000 0xfffcffff 0xfffcc000 0xfffd3fff 0xfffd0000 0xfff03fff 0xfff00000 0xffe03fff 0xffe00000 0xffc00000 aic wd ps pio tc usart1 usart0 sf ebi advanced interrupt controller reserved watchdogtimer power saving parallel i/o controller reserved timer counter universal synchronous/ asynchronous receiver/transmitter 1 universal synchronous/ asynchronous receiver/transmitter 0 reserved special function external bus interface reserved 4k bytes 16k bytes 16k bytes 16k bytes 16k bytes 16k bytes 16k bytes 16k bytes 16k bytes reserved reserved
18 AT91X40 series 1354d ? atarm ? 05/02 ebi: external bus interface the ebi generates the signals that control the access to the external memory or periph- eral devices. the ebi is fully-programmable and can address up to 64m bytes. it has eight chip selects and a 24-bit address bus, the upper four bits of which are multiplexed withachipselect. the 16-bit data bus can be configured to interface with 8- or 16-bit external devices. separate read and write control signals allow for direct memory and peripheral interfacing. the ebi supports different access protocols allowing single-clock cycle memory accesses. the main features are:  external memory mapping  up to 8 chip select lines  8- or 16-bit data bus  byte write or byte select lines  remap of boot memory  two different read protocols  programmable wait state generation  external wait request  programmable data float time the ? ebi user interface ? is described on page 45. external memory mapping the memory map associates the internal 32-bit address space with the external 24-bit address bus. the memory map is defined by programming the base address and page size of the external memories (see ? ebi user interface ? registers ebi_csr0 to ebi_csr7). note that a0 - a23 is only significant for 8-bit memory; a1 - a23 is used for 16-bit memory. if the physical memory device is smaller than the programmed page size, it wraps around and appears to be repeated within the page. the ebi correctly handles any valid access to the memory device within the page (see figure 6). in the event of an access request to an address outside any programmed page, an abort signal is generated. two types of abort are possible: instruction prefetch abort and data abort. the corresponding exception vector addresses are respectively 0x0000000c and 0x00000010. it is up to the system programmer to program the error handling routine to use in case of an abort (see the arm7tdmi datasheet for further information). if two chip selects are defined as having the same base address, an access to the over- lapping address space asserts both ncs lines. the chip select register with the smaller number defines the characteristics of the external access and the behavior of the control signals.
19 AT91X40 series 1354d ? atarm ? 05/02 figure 6. external memory smaller than page size 1m byte device 1m byte device 1m byte device 1m byte device memory map hi low hi low hi low hi low base base + 1m bytes base + 2m bytes base + 3m bytes base + 4m bytes repeat 1 repeat 2 repeat 3
20 AT91X40 series 1354d ? atarm ? 05/02 external bus interface pin description the following table shows how certain ebi signals are multiplexed: name description type a0 - a23 address bus (output) output d0 - d15 data bus (input/output) i/o ncs0 - ncs3 active low chip selects (output) output cs4 - cs7 active high chip selects (output) output nrd read enable (output) output nwr0 - nwr1 lower and upper write enable (output) output noe output enable (output) output nwe write enable (output) output nub, nlb upper and lower byte select (output) output nwait wait request (input) input table 4 . ebi signals multiplexed signals functions a23 - a20 cs4 - cs7 allows from 4 to 8 chip select lines to be used a0 nlb 8- or 16-bit data bus nrd noe byte write or byte select access nwr0 nwe byte write or byte select access nwr1 nub byte write or byte select access
21 AT91X40 series 1354d ? atarm ? 05/02 chip select lines the ebi provides up to eight chip select lines:  chip select lines ncs0 - ncs3 are dedicated to the ebi (not multiplexed).  chip select lines cs4 - cs7 are multiplexed with the top four address lines a23 - a20. by exchanging address lines for chip select lines, the user can optimize the ebi to suit the external memory requirements: more external devices or larger address range for each device. the selection is controlled by the ale field in ebi_mcr (memory control register). the following combinations are possible: a20, a21, a22, a23 (configuration by default) a20, a21, a22, cs4 a20, a21, cs5, cs4 a20, cs6, cs5, cs4 cs7, cs6, cs5, cs4 figure 7. memory connections for four external devices note: for four external devices, the maximum address space per device is 16m bytes. ebi ncs0 - ncs3 nrd nwrx a0 - a23 d0 - d15 ncs3 ncs2 ncs1 ncs0 8 or 16 memory enable memory enable memory enable memory enable output enable write enable a0 - a23 d0 - d15 or d0 - d7
22 AT91X40 series 1354d ? atarm ? 05/02 figure 8. memory connections for eight external devices note: for eight external devices, the maximum address space per device is 1m byte. ebi ncs0 - ncs3 nrd nwrx a0 - a19 d0 - d15 cs7 cs6 cs5 cs4 8 or 16 memory enable memory enable memory enable ncs3 ncs2 ncs1 ncs0 memory enable memory enable memory enable memory enable memory enable output enable write enable a0 - a19 d0 - d15 or d0 - d7 cs4 - cs7
23 AT91X40 series 1354d ? atarm ? 05/02 data bus width a data bus width of 8 or 16 bits can be selected for each chip select. this option is con- trolled by the dbw field in the ebi_csr (chip select register) for the corresponding chip select. figure 9 shows how to connect a 512k x 8-bit memory on ncs2. figure 9. memory connection for an 8-bit data bus figure 10 shows how to connect a 512k x 16-bit memory on ncs2. figure 10. memory connection for a 16-bit data bus ebi d0 - d7 d8 - d15 a1 - a18 a0 nwr0 nrd ncs2 d0 - d7 a1 - a18 a0 write enable output enable memory enable nwr1 ebi d0 - d7 d8 - d15 a1 - a19 nlb nwe noe ncs2 d0 - d7 d8 - d15 a0 - a18 low byte enable write enable output enable memory enable nub high byte enable
24 AT91X40 series 1354d ? atarm ? 05/02 byte write or byte select access each chip select with a 16-bit data bus can operate with one of two different types of write access:  byte write access supports two byte write and a single read signal.  byte select access selects upper and/or lower byte with two byte select lines, and separate read and write signals. this option is controlled by the bat field in the ebi_csr (chip select register) for the corresponding chip select. byte write access is used to connect 2 x 8-bit devices as a 16-bit memory page.  the signal a0/nlb is not used.  the signal nwr1/nub is used as nwr1 and enables upper byte writes.  the signal nwr0/nwe is used as nwr0 and enables lower byte writes.  the signal nrd/noe is used as nrd and enables half-word and byte reads. figure 11 shows how to connect two 512k x 8-bit devices in parallel on ncs2. figure 11. memory connection for 2 x 8-bit data busses ebi d0 - d7 d8 - d15 a1 - a19 a0 nwr0 nrd ncs2 d0 - d7 a0 - a18 write enable read enable memory enable nwr1 d8 - d15 a0 - a18 write enable read enable memory enable
25 AT91X40 series 1354d ? atarm ? 05/02 byte select access is used to connect 16-bit devices in a memory page.  the signal a0/nlb is used as nlb and enables the lower byte for both read and write operations.  the signal nwr1/nub is used as nub and enables the upper byte for both read and write operations.  the signal nwr0/nwe is used as nwe and enables writing for byte or half word.  the signal nrd/noe is used as noe and enables reading for byte or half word. figure 12 shows how to connect a 16-bit device with byte and half-word access (e.g. 16- bit sram) on ncs2. figure 12. connection for a 16-bit data bus with byte and half-word access figure 13 shows how to connect a 16-bit device without byte access (e.g. flash) on ncs2. figure 13. connection for a 16-bit data bus without byte write capability. ebi d0 - d7 d8 - d15 a1 - a19 nlb nwe noe ncs2 d0 - d7 d8 - d15 a0 - a18 low byte enable write enable output enable memory enable nub high byte enable ebi d0 - d7 d8 - d15 a1 - a19 nlb nwe noe ncs2 d0 - d7 d8 - d15 a0 - a18 write enable output enable memory enable nub
26 AT91X40 series 1354d ? atarm ? 05/02 boot on ncs0 depending on the device and the bms pin level during the reset, the user can select either an 8-bit or 16-bit external memory device connected on ncs0 as the boot mem- ory. in this case, ebi_csr0 (chip select register 0) is reset at the following configuration for chip select 0:  8 wait states (wse = 1, nws = 7)  8-bit or 16-bit data bus width, depending on bms byte access type and number of data float time are respectively set to byte write access and 0. with a non-volatile memory interface, any values can be programmed for these parameters. before the remap command, the user can modify the chip select 0 configuration, pro- gramming the ebi_csr0 with exact boot memory characteristics. the base address becomes effective after the remap command, but the new number of wait states can be changed immediately. this is useful if a boot sequence needs to be faster.
27 AT91X40 series 1354d ? atarm ? 05/02 read protocols the ebi provides two alternative protocols for external memory read access: standard and early read. the difference between the two protocols lies in the timing of the nrd (read cycle) waveform. the protocol is selected by the drp field in ebi_mcr (memory control register) and is valid for all memory devices. standard read protocol is the default protocol after reset. note: in the following waveforms and descriptions, nrd represents nrd and noe since the two signals have the same waveform. likewise, nwe represents nwe, nwr0 and nwr1 unless nwr0 and nwr1 are otherwise represented. addr represents a0 - a23 and/or a1 - a23. standard read protocol standard read protocol implements a read cycle in which nrd and nwe are similar. both are active during the second half of the clock cycle. the first half of the clock cycle allows time to ensure completion of the previous access as well as the output of address and ncs before the read cycle begins. during a standard read protocol, external memory access, ncs is set low and addr is valid at the beginning of the access while nrd goes low only in the second half of the master clock cycle to avoid bus conflict (see figure 14). nwe is the same in both proto- cols. nwe always goes low in the second half of the master clock cycle (see figure 15). early read protocol early read protocol provides more time for a read access from the memory by asserting nrd at the beginning of the clock cycle. in the case of successive read cycles in the same memory, nrd remains active continuously. since a read cycle normally limits the speed of operation of the external memory system, early read protocol can allow a faster clock frequency to be used. however, an extra wait state is required in some cases to avoid contentions on the external bus. early read wait state in early read protocol, an early read wait state is automatically inserted when an exter- nal write cycle is followed by a read cycle to allow time for the write cycle to end before the subsequent read cycle begins (see figure 16). this wait state is generated in addi- tion to any other programmed wait states (i.e. data float wait). no wait state is added when a read cycle is followed by a write cycle, between consecu- tive accesses of the same type or between external and internal memory accesses. early read wait states affect the external bus only. they do not affect internal bus timing. figure 14. standard read protocol addr ncs nwe mcki nrd or
28 AT91X40 series 1354d ? atarm ? 05/02 figure 15. early read protocol figure 16. early read wait state writedataholdtime during write cycles in both protocols, output data becomes valid after the falling edge of the nwe signal and remains valid after the rising edge of nwe, as illustrated in figure 17. the external nwe waveform (on the nwe pin) is used to control the output data tim- ing to guarantee this operation. it is therefore necessary to avoid excessive loading of the nwe pins, which could delay the write signal too long and cause a contention with a subsequent read cycle in stan- dard protocol. addr ncs nwe mcki nrd or addr ncs nwe mcki write cycle early read wait read cycle nrd
29 AT91X40 series 1354d ? atarm ? 05/02 figure 17. data hold time in early read protocol the data can remain valid longer than in standard read protocol due to the additional wait cycle which follows a write access. wait states the ebi can automatically insert wait states. the different types of wait states are listed below:  standard wait states  data float wait states  external wait states  chip select change wait states  early read wait states (see ? read protocols ? ) standard wait states each chip select can be programmed to insert one or more wait states during an access on the corresponding device. this is done by setting the wse field in the corresponding ebi_csr. the number of cycles to insert is programmed in the nws field in the same register. below is the correspondence between the number of standard wait states programmed and the number of cycles during which the nwe pulse is held low: 0 wait states1/2 cycle 1 wait state1 cycle for each additional wait state programmed, an additional cycle is added. addr nwe data output mck
30 AT91X40 series 1354d ? atarm ? 05/02 figure 18. one wait state access notes: 1. early read protocol 2. standard read protocol data float wait state some memory devices are slow to release the external bus. for such devices it is nec- essary to add wait states (data float waits) after a read access before starting a write access or a read access to a different external memory. the data float output time (t df ) for each external memory device is programmed in the tdf field of the ebi_csr register for the corresponding chip select. the value (0 - 7 clock cycles) indicates the number of data float waits to be inserted and represents the time allowed for the data output to go high impedance after the memory is disabled. data float wait states do not delay internal memory accesses. hence, a single access to an external memory with long t df will not slow down the execution of a program from internal memory. the ebi keeps track of the programmed external data float time during internal accesses, to ensure that the external memory system is not accessed while it is still busy. internal memory accesses and consecutive accesses to the same external memory do not have added data float wait states. addr ncs nwe mck 1 wait state access nrd (1) (2)
31 AT91X40 series 1354d ? atarm ? 05/02 figure 19. data float output time notes: 1. early read protocol 2. standard read protocol external wait the nwait input can be used to add wait states at any time. nwait is active low and is detected on the rising edge of the clock. if nwait is low at the rising edge of the clock, the ebi adds a wait state and changes neither the output signals nor its internal counters and state. when nwait is de- asserted, the ebi finishes the access sequence. the nwait signal must meet setup and hold requirements on the rising edge of the clock. figure 20. external wait notes: 1. early read protocol 2. standard read protocol addr nrd d0 - d15 mck t df (1) (2) ncs addr ncs nwe mck nrd (1) (2) nwait
32 AT91X40 series 1354d ? atarm ? 05/02 additional constraints are applicable to the at91r40807, the at91m40807 and the at91 40800. the behavior of the ebi is correct when nwait is asserted during an external memory access:  when nwait is asserted before the first rising edge of mcki  when nwait is de-asserted and at least one standard wait state remains to be executed these constraints are not applicable to the at91r40008. chip select change wait states a chip select wait state is automatically inserted when consecutive accesses are made to two different external memories (if no wait states have already been inserted). if any wait states have already been inserted, (e.g., data float wait) then none are added. figure 21. chip select wait notes: 1. early read protocol 2. standard read protocol ncs1 ncs2 mck mem 1 chip select wait mem 2 nrd nwe (1) (2)
33 AT91X40 series 1354d ? atarm ? 05/02 memory access waveforms figures 22 through 25 show examples of the two alternative protocols for external mem- ory read access. figure 22. standard read protocol without t df read mem 1 write mem 1 read mem 1 read mem 2 write mem 2 read mem 2 chip select change wait a0 - a23 nrd nwe ncs1 ncs2 d0 - d15 (mem 1) d0 - d15 (mem 2) d0 - d15 (at91) mck t whdx t whdx
34 AT91X40 series 1354d ? atarm ? 05/02 figure 23. early read protocol without t df read mem 1 write mem 1 a0 - a23 nrd nwe ncs1 ncs2 d0 - d15 (mem 1) d0 - d15 (mem 2) d0- d15 (at91) mck early read wait cycle read mem 1 read mem 2 write mem 2 early read wait cycle read mem 2 chip select change wait long t whdx long t whdx
35 AT91X40 series 1354d ? atarm ? 05/02 figure 24. standard read protocol with t df read mem 1 write mem 1 a0 - a23 nrd nwe ncs1 ncs2 d0 - d15 (mem 1) d0 - d15 (mem 2) d0 - d15 (at91) mck data float wait read mem 1 data float wait read mem 2 read mem 2 data float wait write mem 2 write mem 2 write mem 2 t whdx t df t df t df
36 AT91X40 series 1354d ? atarm ? 05/02 figure 25. early read protocol with t df read mem 1 write mem 1 a0 - a23 nrd nwe ncs1 ncs2 d0 - d15 (mem 1) d0 - d15 (mem 2) d0 - d15 (at91) mck data float wait early read wait read mem 1 data float wait read mem 2 read mem 2 data float wait write mem 2 write mem 2 write mem 2 t df t df t df t whdx
37 AT91X40 series 1354d ? atarm ? 05/02 figures 26 through 32 show the timing cycles and wait states for read and write access to the various AT91X40 series external memory devices. the configurations described are shown in the following table: ta ble 5. memory access waveforms figure number number of wait states bus width size of data transfer 26 0 16 word 27 1 16 word 28 1 16 half-word 29 0 8 word 30 1 8 half-word 31 1 8 byte 32 0 16 byte
38 AT91X40 series 1354d ? atarm ? 05/02 figure 26. 0 wait states, 16-bit bus width, word transfer addr addr+1 b 2 b 1 b 4 b 3 b 4 b 3 b 2 b 1 mck a1 - a23 ncs nrd d0 - d15 internal bus x x b 2 b 1 read access nrd b 2 b 1 b 4 b 3 d0 - d15 write access nwe b 2 b 1 b 4 b 3 d0 - d15 nlb nub standard protocol early protocol byte write/ byte select option
39 AT91X40 series 1354d ? atarm ? 05/02 figure 27. 1 wait, 16-bit bus width, word transfer addr addr+1 b 2 b 1 b 4 b 3 x x b 2 b 1 b 4 b 3 b 2 b 1 1 wait state 1 wair state mck a1 - a23 ncs nrd d0 - d15 internal bus write access read access nrd d0 - d15 standard protocol early protocol b 4 b 3 nwe d0 - d15 b 2 b 1 b 4 b 3 nlb nub b 2 b 1 byte write/ byte select option
40 AT91X40 series 1354d ? atarm ? 05/02 figure 28. 1 wait state, 16-bit bus width, half-word transfer b 2 b 1 1 wait state mck a1 - a23 ncs nrd d0 - d15 internal bus x x b 2 b 1 read access standard protocol nlb nub early protocol b 2 b 1 nrd d0 - d15 write access nwe b 2 b 1 d0 - d15 byte write/ byte select option
41 AT91X40 series 1354d ? atarm ? 05/02 figure 29. 0 wait states, 8-bit bus width, word transfer addr addr+1 x b 1 x b 3 b 2 b 1 mck a0 - a23 ncs nrd d0-d15 internal bus addr+2 addr+3 x x b 2 b 1 x b 2 x x x b 1 x b 3 x b 4 b 4 b 3 b 2 b 1 read access standard protocol early protocol nrd x b 1 d0 - d15 x b 2 x b 3 x b 4 write access nwr0 nwr1 x b 1 d0 - d15 x b 2 x b 3 x b 4
42 AT91X40 series 1354d ? atarm ? 05/02 figure 30. 1 wait state, 8-bit bus width, half-word transfer addr x b 1 1 wait state mck a0 - a23 ncs nrd d0 - d15 internal bus addr+1 1 wait state x x b 2 b 1 x b 2 x x x b 1 read access standard protocol early protocol nrd x b 1 d0 - d15 x b 2 write access nwr0 x b 1 d0 - d15 x b 2 nwr1
43 AT91X40 series 1354d ? atarm ? 05/02 figure 31. 1waitstate,8-bitbuswidth,bytetransfer xb 1 1 wait state mck a0 - a23 ncs nrd d0 - d15 internal bus x x x b 1 read access standard protocol early protocol d0 - d15 x b 1 write access nwr0 d0 - d15 x b 1 nrd nwr1
44 AT91X40 series 1354d ? atarm ? 05/02 figure 32. 0 wait states, 16-bit bus width, byte transfer mck a1 - a23 ncs nwr1 d0 - d15 x b 1 b 2 x addr x x x 0 addr x x x 0 addr x x x 0 addr x x x 1 internal address internal bus x x x b 1 x x b 2 x nlb nub read access standard protocol nrd early protocol nrd d0 - d15 xb 1 b 2 x write access nwr0 d0 - d15 b 1 b 1 b 2 b 2 byte write option byte select option nwe
45 AT91X40 series 1354d ? atarm ? 05/02 ebi user interface the ebi is programmed using the registers listed in the table below. the remap control register (ebi_rcr) controls exit from boot mode (see ? boot on ncs0 ? on page 26.) the memory control register (ebi_mcr) is used to program the number of active chip selects and data read protocol. eight chip select registers (ebi_csr0 to ebi_csr7) are used to program the parameters for the individual external memories. each ebi_csr must be programmed with a different base address, even for unused chip selects. base address: 0xffe00000 (code label ebi_base ) notes: 1. 8-bit boot (if bms is detected high) 2. 16-bit boot (if bms is detected low) ta ble 6. ebi memory map offset register name access reset state 0x00 chip select register 0 ebi_csr0 read/write 0x0000203e (1) 0x0000203d (2) 0x04 chip select register 1 ebi_csr1 read/write 0x10000000 0x08 chip select register 2 ebi_csr2 read/write 0x20000000 0x0c chip select register 3 ebi_csr3 read/write 0x30000000 0x10 chip select register 4 ebi_csr4 read/write 0x40000000 0x14 chip select register 5 ebi_csr5 read/write 0x50000000 0x18 chip select register 6 ebi_csr6 read/write 0x60000000 0x1c chip select register 7 ebi_csr7 read/write 0x70000000 0x20 remap control register ebi_rcr write only ? 0x24 memory control register ebi_mcr read/write 0
46 AT91X40 series 1354d ? atarm ? 05/02 ebi chip select register register name: ebi_csr0 - ebi_csr7 access type: read/write reset value: see table 6 absolute address: 0xffe00000 - 0xffe0001c offset: 0x00 - 0x1c  dbw: data bus width  nws: number of wait states this field is valid only if wse is set.  wse: wait state enable (code label ebi_wse ) 0 = wait state generation is disabled. no wait states are inserted. 1 = wait state generation is enabled. 31 30 29 28 27 26 25 24 ba 23 22 21 20 19 18 17 16 ba ???? 15 14 13 12 11 10 9 8 ?? csen bat tdf pages 76543210 pages ? wse nws dbw dbw data bus width code label ebi_dbw 00reserved ? 0 1 16-bit data bus width ebi_dbw_16 1 0 8-bit data bus width ebi_dbw_8 11reserved ? nws number of standard wait states code label ebi_nws 000 1 ebi_nws_1 001 2 ebi_nws_2 010 3 ebi_nws_3 011 4 ebi_nws_4 100 5 ebi_nws_5 101 6 ebi_nws_6 110 7 ebi_nws_7 111 8 ebi_nws_8
47 AT91X40 series 1354d ? atarm ? 05/02  pages: page size  tdf: data float output time  bat: byte access type  csen: chip select enable (code label ebi_csen ) 0 = chip select is disabled. 1 = chip select is enabled.  ba: base address (code label ebi_ba ) these bits contain the highest bits of the base address. if the page size is larger than 1m byte, the unused bits of the base address are ignored by the ebi decoder. pages page size active bits in base address code label ebi_pages 0 0 1m byte 12 bits (31 - 20) ebi_pages_1m 0 1 4m bytes 10 bits (31 - 22) ebi_pages_4m 1 0 16m bytes 8 bits (31 - 24) ebi_pages_16m 1 1 64m bytes 6 bits (31 - 26) ebi_pages_64m tdf number of cycles added after the transfer code label ebi_tdf 000 0 ebi_tdf_0 001 1 ebi_tdf_1 010 2 ebi_tdf_2 011 3 ebi_tdf_3 100 4 ebi_tdf_4 101 5 ebi_tdf_5 110 6 ebi_tdf_6 111 7 ebi_tdf_7 bat selected bat code label ebi_bat 0 byte-write access type. ebi_bat_byte_write 1 byte-select access type. ebi_bat_byte_select
48 AT91X40 series 1354d ? atarm ? 05/02 ebi remap control register register name: ebi_rcr access type: write only absolute address: 0xffe00020 offset: 0x20  rcb: remap command bit (code label ebi_rcb ) 0=noeffect. 1 = cancels the remapping (performed at reset) of the page zero memory devices. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? rcb
49 AT91X40 series 1354d ? atarm ? 05/02 ebi memory control register register name: ebi_mcr access type: read/write reset value: 0 absolute address: 0xffe00024 offset: 0x24  ale: address line enable this field determines the number of valid address lines and the number of valid chip select lines.  drp: data read protocol 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??? drp ? ale ale valid address bits maximum addressable space valid chip select code label ebi_ale 0 x x a20, a21, a22, a23 16m bytes none ebi_ale_16m 1 0 0 a20, a21, a22 8m bytes cs4 ebi_ale_8m 1 0 1 a20, a21 4m bytes cs4, cs5 ebi_ale_4m 1 1 0 a20 2m bytes cs4, cs5, cs6 ebi_ale_2m 1 1 1 none 1m byte cs4, cs5, cs6, cs7 ebi_ale_1m drp selected drp code label ebi_drp 0 standard read protocol for all external memory devices enabled ebi_drp_standard 1 early read protocol for all external memory devices enabled ebi_drp_early
50 AT91X40 series 1354d ? atarm ? 05/02 ps: power-saving the AT91X40 series ? power-saving feature enables optimization of power consumption. the ps controls the cpu and peripheral clocks. one control register (ps_cr) enables the user to stop the arm7tdmi clock and enter idle mode. one set of registers with a set/clear mechanism enables and disables the peripheral clocks individually. the arm7tdmi clock is enabled after a reset and is automatically re-enabled by any enabled interrupt in the idle mode. peripheral clocks the clock of each peripheral integrated in the AT91X40 series can be individually enabled and disabled by writing to the peripheral clock enable (ps_pcer) and periph- eral clock disable registers (ps_pcdr). the status of the peripheral clocks can be read in the peripheral clock status register (ps_pcsr). when a peripheral clock is disabled, the clock is immediately stopped. when the clock is re-enabled, the peripheral resumes action where it left off. to avoid data corruption or erroneous behavior of the system, the system software only disables the clock after all programmed peripheral operations have finished. the peripheral clocks are automatically enabled after a reset. the bits that control the peripheral clocks are the same as those that control the inter- rupt sources in the aic.
51 AT91X40 series 1354d ? atarm ? 05/02 ps user interface base address : 0xffff4000 (code label ps_base ) table 7 . ps memory map offset register name access reset state 0x00 control register ps_cr write only ? 0x04 peripheral clock enable register ps_pcer write only ? 0x08 peripheral clock disable register ps_pcdr write only ? 0x0c peripheral clock status register ps_pcsr read only 0x17c
52 AT91X40 series 1354d ? atarm ? 05/02 ps control register name: ps_cr access: write only offset: 0x00  cpu: cpu clock disable 0=noeffect. 1 = disables the cpu clock. the cpu clock is re-enabled by any enabled interrupt or by hardware reset. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? cpu
53 AT91X40 series 1354d ? atarm ? 05/02 ps peripheral clock enable register name : ps_pcer access :writeonly offset :0x04  us0: usart 0 clock enable 0=noeffect. 1 = enables the usart 0 clock.  us1: usart 1 clock enable 0=noeffect. 1 = enables the usart 1 clock.  tc0: timer counter 0 clock enable 0=noeffect. 1 = enables the timer counter 0 clock.  tc1: timer counter 1 clock enable 0=noeffect. 1 = enables the timer counter 1 clock.  tc2: timer counter 2 clock enable 0=noeffect. 1 = enables the timer counter 2 clock.  pio: parallel io clock enable 0=noeffect. 1 = enables the parallel io clock. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ??????? pio 76543210 ? tc2 tc1 tc0 us1 us0 ??
54 AT91X40 series 1354d ? atarm ? 05/02 ps peripheral clock disable register name : ps_pcdr access :writeonly offset :0x08  us0: usart 0 clock disable 0=noeffect. 1 = disables the usart 0 clock.  us1: usart 1 clock disable 0=noeffect. 1 = disables the usart 1 clock.  tc0: timer counter 0 clock disable 0=noeffect. 1 = disables the timer counter 0 clock.  tc1: timer counter 1 clock disable 0=noeffect. 1 = disables the timer counter 1 clock.  tc2: timer counter 2 clock disable 0=noeffect. 1 = disables the timer counter 2 clock.  pio: parallel io clock disable 0=noeffect. 1 = disables the parallel io clock. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ??????? pio 76543210 ? tc2 tc1 tc0 us1 us0 ??
55 AT91X40 series 1354d ? atarm ? 05/02 ps peripheral clock status register name : ps_pcsr access : read only reset value :0x17c offset :0x0c  us0: usart 0 clock status 0 = usart 0 clock is disabled. 1 = usart 0 clock is enabled.  us1: usart 1 clock status 0 = usart 1 clock is disabled. 1 = usart 1 clock is enabled.  tc0: timer counter 0 clock status 0 = timer counter 0 clock is disabled. 1 = timer counter 0 clock is enabled.  tc1: timer counter 1 clock status 0 = timer counter 1 clock is disabled. 1 = timer counter 1 clock is enabled.  tc2: timer counter 2 clock status 0 = timer counter 2 clock is disabled. 1 = timer counter 2 clock is enabled.  pio: parallel io clock status 0 = parallel io clock is disabled. 1 = parallel io clock is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ??????? pio 76543210 ? tc2 tc1 tc0 us1 us0 ??
56 AT91X40 series 1354d ? atarm ? 05/02 aic: advanced interrupt controller the AT91X40 series has an 8-level priority, individually maskable, vectored interrupt controller. this feature substantially reduces the software and real-time overhead in handling internal and external interrupts. the interrupt controller is connected to the nfiq (fast interrupt request) and the nirq (standard interrupt request) inputs of the arm7tdmi processor. the processor ? snfiq line can only be asserted by the external fast interrupt request input: fiq. the nirq line can be asserted by the interrupts generated by the on-chip peripherals and the external interrupt request lines: irq0 to irq2. the 8-level priority encoder allows the customer to define the priority between the differ- ent nirq interrupt sources. internal sources are programmed to be level sensitive or edge triggered. external sources can be programmed to be positive or negative edge triggered or high- or low- level sensitive. the interrupt sources are listed in table 8 and the aic programmable registers in table 9. figure 33. interrupt controller block diagram note: after a hardware reset, the aic pins are controlled by the pio controller. they must be configured to be controlled by the peripheral before being used. control logic memorization memorization priority controller nirq manager nfiq manager fiq source advanced peripheral bus (apb) internal interrupt sources external interrupt sources arm7tdmi core nfiq nirq
57 AT91X40 series 1354d ? atarm ? 05/02 note: 1. reserved interrupt sources are not available. corresponding registers must not be used and read 0. table 8 . aic interrupt sources interrupt source (1) interrupt name interrupt description 0 fiq fast interrupt 1 swirq software interrupt 2 us0irq usart channel 0 interrupt 3 us1irq usart channel 1 interrupt 4 tc0irq timer channel 0 interrupt 5 tc1irq timer channel 1 interrupt 6 tc2irq timer channel 2 interrupt 7 wdirq watchdog interrupt 8 pioirq parallel i/o controller interrupt 9 ? reserved 10 ? reserved 11 ? reserved 12 ? reserved 13 ? reserved 14 ? reserved 15 ? reserved 16 irq0 external interrupt 0 17 irq1 external interrupt 1 18 irq2 external interrupt 2 19 ? reserved 20 ? reserved 21 ? reserved 22 ? reserved 23 ? reserved 24 ? reserved 25 ? reserved 26 ? reserved 27 ? reserved 28 ? reserved 29 ? reserved 30 ? reserved 31 ? reserved
58 AT91X40 series 1354d ? atarm ? 05/02 hardware interrupt vectoring the hardware interrupt vectoring reduces the number of instructions to reach the inter- rupt handler to only one. by storing the following instruction at address 0x00000018, the processor loads the program counter with the interrupt handler address stored in the aic_ivr register. execution is then vectored to the interrupt handler corresponding to the current interrupt. ldr pc,[pc,# - &f20] the current interrupt is the interrupt with the highest priority when the interrupt vector register (aic_ivr) is read. the value read in the aic_ivr corresponds to the address stored in the source vector register (aic_svr) of the current interrupt. each interrupt source has its corresponding aic_svr. in order to take advantage of the hardware interrupt vectoring it is necessary to store the address of each interrupt handler in the corresponding aic_svr, at system initialization. priority controller the nirq line is controlled by an 8-level priority encoder. each source has a program- mable priority level of 7 to 0. level 7 is the highest priority and level 0 the lowest. when the aic receives more than one unmasked interrupt at a time, the interrupt with the highest priority is serviced first. if both interrupts have equal priority, the interrupt with the lowest interrupt source number (see table 8) is serviced first. the current priority level is defined as the priority level of the current interrupt at the time the register aic_ivr is read (the interrupt which will be serviced). in the case when a higher priority unmasked interrupt occurs while an interrupt already exists, there are two possible outcomes depending on whether the aic_ivr has been read.  if the nirq line has been asserted but the aic_ivr has not been read, then the processor will read the new higher priority interrupt handler address in the aic_ivr register and the current interrupt level is updated.  if the processor has already read the aic_ivr then the nirq line is reasserted. when the processor has authorized nested interrupts to occur and reads the aic_ivr again, it reads the new, higher priority interrupt handler address. at the same time the current priority value is pushed onto a first-in last-out stack and the current priority is updated to the higher priority. when the end of interrupt command register (aic_eoicr) is written the current inter- rupt level is updated with the last stored interrupt level from the stack (if any). hence at the end of a higher priority interrupt, the aic returns to the previous state corresponding to the preceding lower priority interrupt which had been interrupted. interrupt handling the interrupt handler must read the aic_ivr as soon as possible. this de-asserts the nirq request to the processor and clears the interrupt in case it is programmed to be edge triggered. this permits the aic to assert the nirq line again when a higher priority unmasked interrupt occurs. at the end of the interrupt service routine, the end of interrupt command register (aic_eoicr) must be written. this allows pending interrupts to be serviced. interrupt masking each interrupt source, including fiq, can be enabled or disabled using the command registers aic_iecr and aic_idcr. the interrupt mask can be read in the read only register aic_imr. a disabled interrupt does not affect the servicing of other interrupts.
59 AT91X40 series 1354d ? atarm ? 05/02 interrupt clearing and setting all interrupt sources which are programmed to be edge triggered (including fiq) can be individually set or cleared by respectively writing to the registers aic_iscr and aic_iccr. this function of the interrupt controller is available for auto-test or software debug purposes. fast interrupt request the external fiq line is the only source which can raise a fast interrupt request to the processor. therefore, it has no priority controller. the external fiq line can be programmed to be positive or negative edge triggered or high- or low-level sensitive in the aic_smr0 register. the fast interrupt handler address can be stored in the aic_svr0 register. the value written into this register is available by reading the aic_fvr register when an fiq inter- rupt is raised. by storing the following instruction at address 0x0000001c, the processor will load the program counter with the interrupt handler address stored in the aic_fvr register. ldr pc,[pc,# -&f20] alternatively the interrupt handler can be stored starting from address 0x0000001c as described in the arm7tdmi datasheet. software interrupt interrupt source 1 of the advanced interrupt controller is a software interrupt. it must be programmed to be edge triggered in order to set or clear it by writing to the aic_iscr and aic_iccr. this is totally independent of the swi instruction of the arm7tdmi processor. spurious interrupt when the aic asserts the nirq line, the arm7tdmi enters irq mode and the interrupt handler reads the ivr. it may happen that the aic de-asserts the nirq line after the core has taken into account the nirq assertion and before the read of the ivr. this behavior is called a spurious interrupt. the aic is able to detect these spurious interrupts and returns the spurious vector when the ivr is read. the spurious vector can be programmed by the user when the vector table is initialized. a spurious interrupt may occur in the following cases:  with any sources programmed to be level sensitive, if the interrupt signal of the aic input is de-asserted at the same time as it is taken into account by the arm7tdmi.  if an interrupt is asserted at the same time as the software is disabling the corresponding source through aic_idcr (this can happen due to the pipelining of the arm core). the same mechanism of spurious interrupt occurs if the arm7tdmi reads the ivr (application software or ice) when there is no interrupt pending. this mechanism is also valid for the fiq interrupts. once the aic enters the spurious interrupt management, it asserts neither the nirq nor the nfiq lines to the arm7tdmi as long as the spurious interrupt is not acknowledged. therefore, it is mandatory for the spurious interrupt service routine to acknowledge the ? spurious ? behavior by writing to the aic_eoicr (end of interrupt) before returning to the interrupted software. it also can perform other operation(s), e.g., trace possible undesirable behavior.
60 AT91X40 series 1354d ? atarm ? 05/02 protect mode the protect mode permits reading of the interrupt vector register without performing the associated automatic operations. this is necessary when working with a debug system. when a debug monitor or an ice reads the aic user interface, the ivr could be read. this would have the following consequences in normal mode.  if an enabled interrupt with a higher priority than the current one is pending, it would be stacked  if there is no enabled pending interrupt, the spurious vector would be returned. in either case, an end of interrupt command would be necessary to acknowledge and to restore the context of the aic. this operation is generally not performed by the debug system. hence the debug system would become strongly intrusive, and could cause the application to enter an undesired state. this is avoided by using protect mode. the protect mode is enabled by setting the aic bit in the sf protect mode register (see ? sf: special function registers ? on page 94). when protect mode is enabled, the aic performs interrupt stacking only when a write access is performed on the aic_ivr. therefore, the interrupt service routines must write (arbitrary data) to the aic_ivr just after reading it. the new context of the aic, including the value of the interrupt status register (aic_isr), is updated with the current interrupt only when ivr is written. an aic_ivr read on its own (e.g. by a debugger), modifies neither the aic context nor the aic_isr. extra aic_ivr reads performed in between the read and the write can cause unpredict- able results. therefore, it is strongly recommended not to set a breakpoint between these two actions, nor to stop the software. the debug system must not write to the aic_ivr as this would cause undesirable effects. the following table shows the main steps of an interrupt and the order in which they are performed according to the mode: notes: 1. nirq de-assertion and automatic interrupt clearing if the source is programmed as level sensitive. 2. software that has been written and debugged using protect mode will run correctly in normal mode without modification. however, in normal mode the aic_ivr write has no effect and can be removed to optimize the code. action normal mode protect mode calculate active interrupt (higher than current or spurious) read aic_ivr read aic_ivr determine and return the vector of the active interrupt read aic_ivr read aic_ivr memorize interrupt read aic_ivr read aic_ivr push on internal stack the current priority level read aic_ivr write aic_ivr acknowledge the interrupt (1) read aic_ivr write aic_ivr no effect (2) write aic_ivr ?
61 AT91X40 series 1354d ? atarm ? 05/02 aic user interface  base address: 0xfffff000 (code label aic_base ) note: the reset value of this register depends on the level of the external irq lines. all other sources are cleared at reset. table 9 . aic memory map offset register name access reset state 0x000 source mode register 0 aic_smr0 read/write 0 0x004 source mode register 1 aic_smr1 read/write 0 ?? ? read/write 0 0x07c source mode register 31 aic_smr31 read/write 0 0x080 source vector register 0 aic_svr0 read/write 0 0x084 source vector register 1 aic_svr1 read/write 0 ?? ? read/write 0 0x0fc source vector register 31 aic_svr31 read/write 0 0x100 irq vector register aic_ivr read only 0 0x104 fiq vector register aic_fvr read only 0 0x108 interrupt status register aic_isr read only 0 0x10c interrupt pending register aic_ipr read only (see note 1) 0x110 interrupt mask register aic_imr read only 0 0x114 core interrupt status register aic_cisr read only 0 0x118 reserved ?? ? 0x11c reserved ??? 0x120 interrupt enable command register aic_iecr write only ? 0x124 interrupt disable command register aic_idcr write only ? 0x128 interrupt clear command register aic_iccr write only ? 0x12c interrupt set command register aic_iscr write only ? 0x130 end of interrupt command register aic_eoicr write only ? 0x134 spurious vector register aic_spu read/write 0
62 AT91X40 series 1354d ? atarm ? 05/02 aic source mode register register name : aic_smr0 - aic_smr31 access type : read/write reset value :0 offset : 0x000 - 0x07c  prior: priority level (code label aic_prior ) program the priority level for all sources except source 0 (fiq). the priority level can be between 0 (lowest) and 7 (highest). theprioritylevelisnotusedforthefiq,inthesmr0.  srctype: interrupt source type program the input to be positive or negative level sensitive or positive or negative edge triggered. the active level or edge is not programmable for the internal sources. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ? srctype ?? prior srctype external sources code label aic_srctype 0 0 low level sensitive aic_srctype_ext_low_level 0 1 negative edge triggered aic_srctype_ext_negative_edge 1 0 high level sensitive aic_srctype_ext_high_level 1 1 positive edge triggered aic_srctype_ext_positive_edge srctype internal sources code label aic_srctype x 0 level sensitive aic_srctype_int_level x 1 edge triggered aic_srctype_int_edge
63 AT91X40 series 1354d ? atarm ? 05/02 aic source vector register register name : aic_svr0 - aic_svr31 access type : read/write reset value :0 offset : 0x080 - 0x0fc  vector: interrupt handler address the user may store in these registers the addresses of the corresponding handler for each interrupt source. 31 30 29 28 27 26 25 24 vector 23 22 21 20 19 18 17 16 vector 15 14 13 12 11 10 9 8 vector 76543210 vector
64 AT91X40 series 1354d ? atarm ? 05/02 aic interrupt vector register register name :aic_ivr access type : read only reset value :0 offset :0x100  irqv: interrupt vector register the irq vector register contains the vector programmed by the user in the source vector register corresponding to the current interrupt. the source vector register (1 to 31) is indexed using the current interrupt number when the interrupt vector register is read. when there is no current interrupt, the irq vector register reads 0. aic fiq vector register register name :aic_fvr access type : read only reset value :0 offset :0x104  fiqv: fiq vector register the fiq vector register contains the vector programmed by the user in the source vector register 0 which corresponds to fiq. 31 30 29 28 27 26 25 24 irqv 23 22 21 20 19 18 17 16 irqv 15 14 13 12 11 10 9 8 irqv 76543210 irqv 31 30 29 28 27 26 25 24 fiqv 23 22 21 20 19 18 17 16 fiqv 15 14 13 12 11 10 9 8 fiqv 76543210 fiqv
65 AT91X40 series 1354d ? atarm ? 05/02 aic interrupt status register register name :aic_isr access type : read only reset value :0 offset :0x108  irqid: current irq identifier (code label aic_irqid ) the interrupt status register returns the current interrupt source number. aic interrupt pending register register name :aic_ipr access type : read only reset value :0 offset :0x10c  interrupt pending 0 = corresponding interrupt is inactive. 1 = corresponding interrupt is pending. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??? irqid 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? irq2 irq1 irq0 15 14 13 12 11 10 9 8 ??????? pioirq 76543210 wdirq tc2irq tc1irq tc0irq us1irq us0irq swirq fiq
66 AT91X40 series 1354d ? atarm ? 05/02 aic interrupt mask register register name :aic_imr access type : read only reset value :0 offset :0x110  interrupt mask 0 = corresponding interrupt is disabled. 1 = corresponding interrupt is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? irq2 irq1 irq0 15 14 13 12 11 10 9 8 ??????? pioirq 76543210 wdirq tc2irq tc1irq tc0irq us1irq us0irq swirq fiq
67 AT91X40 series 1354d ? atarm ? 05/02 aic core interrupt status register register name :aic_cisr access type : read only reset value :0 offset :0x114  nfiq: nfiq status (code label aic_nfiq ) 0 = nfiq line inactive. 1 = nfiq line active.  nirq: nirq status (code label aic_nirq ) 0 = nirq line inactive. 1 = nirq line active. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?????? nirq nfiq
68 AT91X40 series 1354d ? atarm ? 05/02 aic interrupt enable command register register name :aic_iecr access type :writeonly offset :0x120  interrupt enable 0=noeffect. 1 = enables corresponding interrupt. aic interrupt disable command register register name :aic_idcr access type :writeonly offset :0x124  interrupt disable 0=noeffect. 1 = disables corresponding interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? irq2 irq1 irq0 15 14 13 12 11 10 9 8 ??????? pioirq 76543210 wdirq tc2irq tc1irq tc0irq us1irq us0irq swirq fiq 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? irq2 irq1 irq0 15 14 13 12 11 10 9 8 ??????? pioirq 76543210 wdirq tc2irq tc1irq tc0irq us1irq us0irq swirq fiq
69 AT91X40 series 1354d ? atarm ? 05/02 aic interrupt clear command register register name :aic_iccr access type :writeonly offset :0x128  interrupt clear 0=noeffect. 1 = clears corresponding interrupt. aic interrupt set command register register name :aic_iscr access type :writeonly offset :0x12c  interrupt set 0=noeffect. 1 = sets corresponding interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? irq2 irq1 irq0 15 14 13 12 11 10 9 8 ??????? pioirq 76543210 wdirq tc2irq tc1irq tc0irq us1irq us0irq swirq fiq 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? irq2 irq1 irq0 15 14 13 12 11 10 9 8 ??????? pioirq 76543210 wdirq tc2irq tc1irq tc0irq us1irq us0irq swirq fiq
70 AT91X40 series 1354d ? atarm ? 05/02 aic end of interrupt command register register name :aic_eoicr access type :writeonly offset :0x130 the end of interrupt command register is used by the interrupt routine to indicate that the interrupt treatment is complete. any value can be written because it is only necessary to make a write to this register location to signal the end of interrupt treatment. aic spurious vector register register name :aic_spu access type : read/write reset value :0 offset :0x134  spuvec: spurious interrupt vector handler address the user may store the address of the spurious interrupt handler in this register. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ???????? 31 30 29 28 27 26 25 24 spuvec 23 22 21 20 19 18 17 16 spuvec 15 14 13 12 11 10 9 8 spuvec 76543210 spuvec
71 AT91X40 series 1354d ? atarm ? 05/02 standard interrupt sequence it is assumed that:  the advanced interrupt controller has been programmed, aic_svr are loaded with corresponding interrupt service routine addresses and interrupts are enabled.  the instruction at address 0x18(irq exception vector address) is ldr pc, [pc, # - &f20] when nirq is asserted, if the bit i of cpsr is 0, the sequence is: 1. the cpsr is stored in spsr_irq, the current value of the program counter is loaded in the irq link register (r14_irq) and the program counter (r15) is loaded with 0x18. in the following cycle during fetch at address 0x1c, the arm core adjusts r14_irq, decrementing it by 4. 2. the arm core enters irq mode, if it is not already. 3. when the instruction loaded at address 0x18 is executed, the program counter is loaded with the value read in aic_ivr. reading the aic_ivr has the following effects: ? set the current interrupt to be the pending one with the highest priority. the current level is the priority level of the current interrupt. ? de-assert the nirq line on the processor. (even if vectoring is not used, aic_ivr must be read in order to de-assert nirq) ? automatically clear the interrupt, if it has been programmed to be edge triggered ? pushthecurrentlevelontothestack ? return the value written in the aic_svr corresponding to the current interrupt 4. the previous step has effect to branch to the corresponding interrupt service routine. this should start by saving the link register(r14_irq) and the spsr(spsr_irq). note that the link register must be decremented by 4 when it is saved, if it is to be restored directly into the program counter at the end of the interrupt. 5. further interrupts can then be unmasked by clearing the i bit in the cpsr, allow- ing re-assertion of the nirq to be taken into account by the core. this can occur if an interrupt with a higher priority than the current one occurs. 6. the interrupt handler can then proceed as required, saving the registers which will be used and restoring them at the end. during this phase, an interrupt of pri- ority higher than the current level will restart the sequence from step 1. note that if the interrupt is programmed to be level sensitive, the source of the interrupt must be cleared during this phase. 7. the i bit in the cpsr must be set in order to mask interrupts before exiting, to ensure that the interrupt is completed in an orderly manner. 8. the end of interrupt command register (aic_eoicr) must be written in order to indicate to the aic that the current interrupt is finished. this causes the cur- rent level to be popped from the stack, restoring the previous current level if one exists on the stack. if another interrupt is pending, with lower or equal priority than old current level but with higher priority than the new current level, the nirq line is re-asserted, but the interrupt sequence does not immediately start because the i bit is set in the core. 9. the spsr (spsr_irq) is restored. finally, the saved value of the link register is restored directly into the pc. this has effect of returning from the interrupt to whatever was being executed before, and of loading the cpsr with the stored
72 AT91X40 series 1354d ? atarm ? 05/02 spsr, masking or unmasking the interrupts depending on the state saved in the spsr (the previous state of the arm core). note: the i bit in the spsr is significant. if it is set, it indicates that the arm core was just about to mask irq interrupts when the mask instruction was interrupted. hence, when the spsr is restored, the mask instruction is completed (irq is masked).
73 AT91X40 series 1354d ? atarm ? 05/02 fast interrupt sequence it is assumed that:  the advanced interrupt controller has been programmed, aic_svr[0] is loaded with fast interrupt service routine address and the fast interrupt is enabled.  the instruction at address 0x1c(fiq exception vector address) is:  ldr pc, [pc, # - &f20].  nested fast interrupts are not needed by the user. when nfiq is asserted, if the bit f of cpsr is 0, the sequence is: 1. the cpsr is stored in spsr_fiq, the current value of the program c ounter is loaded in the fiq link register (r14_fiq) and the program counter (r15) is loaded with 0x1c. in the following cycle, during fetch at address 0x20, the arm core adjusts r14_fiq, decrementing it by 4. 2. the arm core enters fiq mode. 3. when the instruction loaded at address 0x1c is executed, the program counter is loaded with the value read in aic_fvr. reading the aic_fvr has effect of automatically clearing the fast interrupt (source 0 connected to the fiq line), if it has been programmed to be edge triggered. in this case only, it de-asserts the nfiq line on the processor. 4. the previous step has effect to branch to the corresponding interrupt service routine. it is not necessary to save the link register(r14_fiq) and the spsr(spsr_fiq) if nested fast interrupts are not needed. 5. the interrupt handler can then proceed as required. it is not necessary to save registers r8 to r13 because fiq mode has its own dedicated registers and the user r8 to r13 are banked. the other registers, r0 to r7, must be saved before being used, and restored at the end (before the next step). note that if the fast interrupt is programmed to be level sensitive, the source of the interrupt must be cleared during this phase in order to de-assert the nfiq line. 6. finally, the link register (r14_fiq) is restored into the pc after decrementing it by 4 (with instruction sub pc, lr, #4 for example). this has effect of returning from the interrupt to whatever was being executed before, and of loading the cpsr with the spsr, masking or unmasking the fast interrupt d epending on the state saved in the spsr. note: the f bit in the spsr is significant. if it is set, it indicates that the arm core was just about to mask fiq interrupts when the mask instruction was interrupted. hence when the spsr is restored, the interrupted instruction is completed (fiq is masked).
74 AT91X40 series 1354d ? atarm ? 05/02 pio: parallel i/o controller the AT91X40 series has 32 programmable i/o lines. six pins are dedicated as general purpose i/o pins (p16, p17, p18, p19, p23 and p24). other i/o lines are multiplexed with an external signal of a peripheral to optimize the use of available package pins (see table 10). the pio controller also provides an internal interrupt signal to the advanced interrupt controller. multiplexed i/o lines some i/o lines are multiplexed with an i/o signal of a peripheral. after reset, the pin is generally controlled by the pio controller and is in input mode. table 10 indicates which of these pins are not controlled by the pio controller after reset. when a peripheral signal is not used in an application, the corresponding pin can be used as a parallel i/o. each parallel i/o line is bi-directional, whether the peripheral defines the signal as input or output. figure 34 shows the multiplexing of the peripheral signals with parallel i/o signals. if a pin is multiplexed between the pio controller and a peripheral, the pin is controlled by the registers pio_per (pio enable) and pio_pdr (pio disable). the register pio_psr (pio status) indicates whether the pin is controlled by the corresponding peripheral or by the pio controller. if a pin is a general-purpose parallel i/o pin (not multiplexed with a peripheral), pio_per and pio_pdr have no effect and pio_psr returns 1 for the bits correspond- ing to these pins. when the pio is selected, the peripheral input line is connected to zero. output selection the user can enable each individual i/o signal as an output with the registers pio_oer (output enable) and pio_odr (output disable). the output status of the i/o signals can be read in the register pio_osr (output status). the direction defined has effect only if the pin is configured to be controlled by the pio controller. i/o levels each pin can be configured to be driven high or low. the level is defined in four different ways, according to the following conditions. if a pin is controlled by the pio controller and is defined as an output (see ? output selection ? above), the level is programmed using the registers pio_sodr (set output data) and pio_codr (clear output data). in this case, the programmed value can be read in pio_odsr (output data status). if a pin is controlled by the pio controller and is not defined as an output, the level is determined by the external circuit. if a pin is not controlled by the pio controller, the state of the pin is defined by the peripheral (see peripheral datasheets). in all cases, the level on the pin can be read in the register pio_pdsr (pin data status). filters optional input glitch filtering is available on each pin of the at91m40800, the at91m40807 and the at91r40807. filtering is controlled by the registers pio_ifer (input filter enable) and pio_ifdr (input filter disable). the input glitch filtering can be selected whether the pin is used for its peripheral function or as a parallel i/o line. the register pio_ifsr (input filter status) indicates whether or not the filter is activated for each pin.
75 AT91X40 series 1354d ? atarm ? 05/02 interrupts each parallel i/o can be programmed to generate an interrupt when a level change occurs. this is controlled by the pio_ier (interrupt enable) and pio_idr (interrupt dis- able) registers which enable/disable the i/o interrupt by setting/clearing the corresponding bit in the pio_imr. when a change in level occurs, the corresponding bit in the pio_isr (interrupt status) is set whether the pin is used as a pio or a peripheral and whether it is defined as input or output. if the corresponding interrupt in pio_imr (interrupt mask) is enabled, the pio interrupt is asserted. when pio_isr is read, the register is automatically cleared. user interface each individual i/o is associated with a bit position in the parallel i/o user interface reg- isters. each of these registers are 32 bits wide. if a parallel i/o line is not defined, writing to the corresponding bits has no effect. undefined bits read zero.
76 AT91X40 series 1354d ? atarm ? 05/02 figure 34. parallel i/o multiplexed with a bi-directional signal note: the filter is not implemented in the at91r40008. pad pio_osr 1 0 1 0 pio_psr pio_odsr 1 0 filter* 0 1 pio_ifsr pio_psr event detection pio_pdsr pio_isr pio_imr peripheral output enable peripheral output peripheral input pioirq pad output enable pad output pad input
77 AT91X40 series 1354d ? atarm ? 05/02 note: bit number refers to the data bit that corresponds to this signal in each of the user interface registers. table 1 0. multiplexed parallel i/os pio controller peripheral reset state pin number bit number (1) port name port name signal description signal direction 0 p0 tclk0 timer 0 clock signal input pio input 49 1 p1 tioa0 timer 0 signal a bi-directional pio input 50 2 p2 tiob0 timer 0 signal b bi-directional pio input 51 3 p3 tclk1 timer 1 clock signal input pio input 54 4 p4 tioa1 timer 1 signal a bi-directional pio input 55 5 p5 tiob1 timer 1 signal b bi-directional pio input 56 6 p6 tclk2 timer 2 clock signal input pio input 57 7 p7 tioa2 timer 2 signal a bi-directional pio input 58 8 p8 tiob2 timer 2 signal b bi-directional pio input 59 9 p9 irq0 external interrupt 0 input pio input 60 10 p10 irq1 external interrupt 1 input pio input 63 11 p11 irq2 external interrupt 2 input pio input 64 12 p12 fiq fast interrupt input pio input 66 13 p13 sck0 usart 0 clock signal bi-directional pio input 67 14 p14 txd0 usart 0 transmit data signal output pio input 68 15 p15 rxd0 usart 0 receive data signal input pio input 69 16 p16 ?? ? pio input 70 17 p17 ?? ? pio input 71 18 p18 ?? ? pio input 72 19 p19 ?? ? pio input 73 20 p20 sck1 usart 1 clock signal bi-directional pio input 74 21 p21 txd1 usart 1 transmit data signal output pio input 75 22 p22 rxd1 usart 1 receive data signal input pio input 76 23 p23 ?? ? pio input 83 24 p24 ?? ? pio input 84 25 p25 mcko master clock output output mcko 85 26 p26 ncs2 chip select 2 output ncs2 99 27 p27 ncs3 chip select 3 output ncs3 100 28 p28 a20/cs7 address 20/chip select 7 output a20 25 29 p29 a21/cs6 address 21/chip select 6 output a21 26 30 p30 a22/cs5 address 22/chip select 5 output a22 29 31 p31 a23/cs4 address 23/chip select 4 output a23 30
78 AT91X40 series 1354d ? atarm ? 05/02 pio user interface pio base address : 0xffff0000 (code label pio_base ) notes: 1. the reset value of this register depends on the level of the external pins at reset. 2. this register is cleared at reset. however, the first read of the register can give a value not equal to zero if any changes have occurred on any pins between the reset and the read. 3. this register exists in the at91r40008 but its value has no meaning, since the filters are not implemented. table 1 1. pio controller memory map offset register name access reset state 0x00 pio enable register pio_per write only ? 0x04 pio disable register pio_pdr write only ? 0x08 pio status register pio_psr read only 0x01ffffff (see also table 10) 0x0c reserved ??? 0x10 output enable register pio_oer write only ? 0x14 output disable register pio_odr write only ? 0x18 output status register pio_osr read only 0 0x1c reserved ??? 0x20 input filter enable register pio_ifer write only ? 0x24 input filter disable register pio_ifdr write only ? 0x28 input filter status register (3) pio_ifsr read only 0 0x2c reserved ??? 0x30 set output data register pio_sodr write only ? 0x34 clear output data register pio_codr write only ? 0x38 output data status register pio_odsr read only 0 0x3c pin data status register pio_pdsr read only (see note 1) 0x40 interrupt enable register pio_ier write only ? 0x44 interrupt disable register pio_idr write only ? 0x48 interrupt mask register pio_imr read only 0 0x4c interrupt status register pio_isr read only (see note 2)
79 AT91X40 series 1354d ? atarm ? 05/02 pio enable register register name : pio_per access type :writeonly offset :0x00 this register is used to enable individual pins to be controlled by the pio controller instead of the associated peripheral. when the pio is enabled, the associated peripheral input (if any) is held at logic zero. 1 = enables the pio to control the corresponding pin (disables peripheral control of the pin). 0=noeffect. pio disable register register name :pio_pdr access type :writeonly offset :0x04 this register is used to disable pio control of individual pins. when the pio control is disabled, the normal peripheral func- tion is enabled on the corresponding pin. 1 = disables pio control (enables peripheral control) on the corresponding pin. 0=noeffect. 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
80 AT91X40 series 1354d ? atarm ? 05/02 pio status register register name : pio_psr access type : read only reset value : 0x01ffffff offset :0x08 this register indicates which pins are enabled for pio control. this register is updated when pio lines are enabled or disabled. 1 = pio is active on the corresponding line (peripheral is inactive). 0 = pio is inactive on the corresponding line (peripheral is active). 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
81 AT91X40 series 1354d ? atarm ? 05/02 pio output enable register register name :pio_oer access type :writeonly offset :0x10 this register is used to enable pio output drivers. if the pin is driven by a peripheral, this has no effect on the pin, but the information is stored. the register is programmed as follows: 1 = enables the pio output on the corresponding pin. 0=noeffect. pio output disable register register name :pio_odr access type :writeonly offset :0x14 this register is used to disable pio output drivers. if the pin is driven by the peripheral, this has no effect on the pin, but the information is stored. the register is programmed as follows: 1 = disables the pio output on the corresponding pin. 0=noeffect. 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
82 AT91X40 series 1354d ? atarm ? 05/02 pio output status register register name :pio_osr access type : read only reset value :0 offset :0x18 this register shows the pio pin control (output enable) status which is programmed in pio_oer and pio odr. the defined value is effective only if the pin is controlled by the pio. the register reads as follows: 1 = the corresponding pio is output on this line. 0 = the corresponding pio is input on this line. 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
83 AT91X40 series 1354d ? atarm ? 05/02 pio input filter enable register register name :pio_ifer access type :writeonly offset :0x20 this register is used to enable input glitch filters. it affects the pin whether or not the pio is enabled. the register is pro- grammed as follows: 1 = enables the glitch filter on the corresponding pin. 0=noeffect. pio input filter disable register register name :pio_ifdr access type :writeonly offset :0x24 this register is used to disable input glitch filters. it affects the pin whether or not the pio is enabled. the register is pro- grammed as follows: 1 = disables the glitch filter on the corresponding pin. 0=noeffect. 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
84 AT91X40 series 1354d ? atarm ? 05/02 pio input filter status register register name :pio_ifsr access type : read only reset value :0 offset :0x28 this register indicates which pins have glitch filters selected. it is updated when pio outputs are enabled or disabled by writing to pio_ifer or pio_ifdr. 1 = filter is selected on the corresponding input (peripheral and pio). 0 = filter is not selected on the corresponding input. 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
85 AT91X40 series 1354d ? atarm ? 05/02 pio set output data register register name :pio_sodr access type :writeonly offset :0x30 this register is used to set pio output data. it affects the pin only if the corresponding pio output line is enabled and if the pin is controlled by the pio. otherwise, the information is stored. 1 = pio output data on the corresponding pin is set. 0=noeffect. pio clear output data register register name :pio_codr access type :writeonly offset :0x34 this register is used to clear pio output data. it affects the pin only if the corresponding pio output line is enabled and if the pin is controlled by the pio. otherwise, the information is stored. 1 = pio output data on the corresponding pin is cleared. 0=noeffect. 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
86 AT91X40 series 1354d ? atarm ? 05/02 pio output data status register register name :pio_odsr access type : read only reset value :0 offset :0x38 this register shows the output data status which is programmed in pio_sodr or pio_codr. the defined value is effec- tive only if the pin is controlled by the pio controller and only if the pin is defined as an output. 1 = the output data for the corresponding line is programmed to 1. 0 = the output data for the corresponding line is programmed to 0. pio pin data status register register name :pio_pdsr access type : read only reset value :seetable11 offset :0x3c this register shows the state of the physical pin of the chip. the pin values are always valid regardless of whether the pins are enabled as pio, peripheral, input or output. the register reads as follows: 1 = the corresponding pin is at logic 1. 0 = the corresponding pin is at logic 0. 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
87 AT91X40 series 1354d ? atarm ? 05/02 pio interrupt enable register register name :pio_ier access type :writeonly offset :0x40 this register is used to enable pio interrupts on the corresponding pin. it has effect whether pio is enabled or not. 1 = enables an interrupt when a change of logic level is detected on the corresponding pin. 0=noeffect. pio interrupt disable register register name :pio_idr access type :writeonly offset :0x44 this register is used to disable pio interrupts on the corresponding pin. it has effect whether the pio is enabled or not. 1 = disables the interrupt on the corresponding pin. logic level changes are still detected. 0=noeffect. 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
88 AT91X40 series 1354d ? atarm ? 05/02 pio interrupt mask register register name :pio_imr access type : read only reset value :0 offset :0x48 this register shows which pins have interrupts enabled. it is updated when interrupts are enabled or disabled by writing to pio_ier or pio_idr. 1 = interrupt is enabled on the corresponding input pin. 0 = interrupt is not enabled on the corresponding input pin. pio interrupt status register register name :pio_isr access type : read only reset value :0 offset :0x4c this register indicates for each pin when a logic value change has been detected (rising or falling edge). this is valid whether the pio is selected for the pin or not and whether the pin is an input or output. the register is reset to zero following a read, and at reset. 1 = at least one change has been detected on the corresponding pin since the register was last read. 0 = no change has been detected on the corresponding pin since the register was last read. 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31p30p29p28p27p26p25p24 23 22 21 20 19 18 17 16 p23p22p21p20p19p18p17p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
89 AT91X40 series 1354d ? atarm ? 05/02 wd: watchdog timer the AT91X40 series has an internal watchdog timer which can be used to prevent sys- tem lock-up if the software becomes trapped in a deadlock. in normal operation the user reloads the watchdog at regular intervals before the timer overflow occurs. if an overflow does occur, the watchdog timer generates one or a combination of the following signals, depending on the parameters in wd_omr (overflow mode register):  if rsten is set, an internal reset is generated (wd_r eset as shown in figure 35).  if irqen is set, a pulse is generated on the signal wdirq which is connected to the advanced interrupt controller  if exten is set, a low level is driven on the nwdovf signal for a duration of 8 mck cycles. the watchdog timer has a 16-bit down counter. bits 12-15 of the value loaded when the watchdog is restarted are programmable using the hpvc parameter in wd_cmr (clock mode). four clock sources are available to the watchdog counter: mck/8, mck/32, mck/128 or mck/1024. the selection is made using the wdclks parameter in wd_cmr. this provides a programmable time-out period of 1 ms to 2 sec. with a 33 mhz system clock. all write accesses are protected by control access keys to help prevent corruption of the watchdog should an error condition occur. to update the contents of the mode and con- trol registers it is necessary to write the correct bit pattern to the control access key bits at the same time as the control bits are written (the same write access). figure 35. watchdog timer block diagram advanced peripheral bus (apb) wd_reset wdirq mcki/8 mcki/32 mcki/128 mcki/1024 control logic clock select 16-bit programmable down counter clk_cnt clear overflow nwdovf
90 AT91X40 series 1354d ? atarm ? 05/02 wd user interface wd base address : 0xffff8000 (code label wd_base ) wd overflow mode register name :wd_omr access : read/write reset value :0 offset :0x00  wden: watch dog enable (code label wd_wden ) 0 = watch dog is disabled and does not generate any signals. 1 = watch dog is enabled and generates enabled signals.  rsten: reset enable (code label wd_rsten ) 0 = generation of an internal reset by the watch dog is disabled. 1 = when overflow occurs, the watch dog generates an internal reset.  irqen: interrupt enable (code label wd_irqen ) 0 = generation of an interrupt by the watch dog is disabled. 1 = when overflow occurs, the watch dog generates an interrupt.  exten: external signal enable (code label wd_exten ) 0 = generation of a pulse on the pin nwdovf by the watch dog is disabled. 1 = when an overflow occurs, a pulse on the pin nwdovf is generated.  okey: overflow access key (code label wd_okey ) used only when writing wd_omr. okey is read as 0. 0x234 = write access in wd_omr is allowed. other value = write access in wd_omr is prohibited. table 1 2. wd memory map offset register name access reset state 0x00 overflow mode register wd_omr read/write 0 0x04 clock mode register wd_cmr read/write 0 0x08 control register wd_cr write only ? 0x0c status register wd_sr read only 0 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 okey 76543210 okey exten irqen rsten wden
91 AT91X40 series 1354d ? atarm ? 05/02 wd clock mode register name : wd_cmr access : read/write reset value :0 offset :0x04  wdclks: clock selection  hpcv: high preload counter value (code label wd_hpcv ) counter is preloaded when watchdog counter is restarted with bits 0 to 11 set (fff) and bits 12 to 15 equaling hpcv.  ckey: clock access key (code label wd_ckey ) used only when writing wd_cmr. ckey is read as 0. 0x06e: write access in wd_cmr is allowed. other value: write access in wd_cmr is prohibited. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ckey 76543210 ckey ? hpcv wdclks wdclks clock selected code label wd_wdclks 00mck/8 wd_wdclks_mck8 01mck/32 wd_wdclks_mck32 1 0 mck/128 wd_wdclks_mck128 1 1 mck/1024 wd_wdclks_mck1024
92 AT91X40 series 1354d ? atarm ? 05/02 wd control register name : wd_cr access :writeonly offset :0x08  rstkey: restart key (code label wd_rstkey ) 0xc071 = watch dog counter is restarted. other value = no effect. wd status register name :wd_sr access : read only reset value :0 offset :0x0c  wdovf: watchdog overflow (code label wd_wdovf ) 0 = no watchdog overflow. 1 = a watchdog overflow has occurred since the last restart of the watchdog counter or since internal or external reset. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 rstkey 76543210 rstkey 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? wdovf
93 AT91X40 series 1354d ? atarm ? 05/02 wd enabling sequence to enable the watchdog timer the sequence is as follows: 1. disable the watchdog by clearing the bit wden: write 0x2340 to wd_omr this step is unnecessary if the wd is already disabled (reset state). 2. initialize the wd clock mode register: write 0x373c to wd_cmr (hpcv = 15 and wdclks = mck/8) 3. restart the timer: write 0xc071 to wd_cr 4. enable the watchdog: write 0x2345 to wd_omr (interrupt enabled)
94 AT91X40 series 1354d ? atarm ? 05/02 sf: special function registers the AT91X40 series provides registers which implement the following special functions.  chip identification  reset status  protect mode (see ? protect mode ? on page 60) chip identification table 13 provides the chip id values for the products described in this datasheet. sf user interface chip id base address = 0xfff00000 (code label sf_base ) table 1 3. chip id values product chip at91m40800 0x14080044 at91r40807 0x44080746 at91m40807 0x14080745 at91r40008 0x44000840 table 1 4. sf memory map offset register name access reset state 0x00 chip id register sf_cidr read only hardwired 0x04 chip id extension register sf_exid read only hardwired 0x08 reset status register sf_rsr read only see register description 0x0c memory mode register sf_mmr read/write 0x0 0x10 reserved ??? 0x14 reserved ??? 0x18 protect mode register sf_pmr read/write 0x0
95 AT91X40 series 1354d ? atarm ? 05/02 chip id register register name : sf_cidr access type : read only reset value : hardwired offset :0x00  version: version of the chip (code label sf_version ) this value is incremented by one with each new version of the chip (from zero to a maximum value of 31).  nvpsiz: non volatile program memory size  nvdsiz: non volatile data memory size 31 30 29 28 27 26 25 24 ext nvptyp arch 23 22 21 20 19 18 17 16 arch vdsiz 15 14 13 12 11 10 9 8 nvdsiz nvpsiz 76543210 0 1 0 version nvpsiz size code label sf_nvpsiz 0000none sf_nvpsiz_none 001132kbytes sf_nvpsiz_32k 010164kbytes sf_nvpsiz_64k 0111128kbytes sf_nvpsiz_128k 1001256kbytes sf_nvpsiz_256k others reserved ? nvdsiz size code label sf_nvdsiz 0000none sf_nvdsiz_none others reserved ?
96 AT91X40 series 1354d ? atarm ? 05/02  vdsiz: volatile data memory size  arch: chip architecture (code label sf_arch ) code of architecture: two bcd digits.  nvptyp: non volatile program memory type  ext:extensionflag(codelabel sf_ext ) 0 = chip id has a single register definition without extensions 1 = an extended chip id exists (to be defined in the future). chip id extension register register name :sf_exid access type : read only reset value : hardwired offset :0x04 this register is reserved for future use. it will be defined when needed. vdsiz size code label sf_vdsiz 0000none sf_vdsiz_none 00011kbytes sf_vdsiz_1k 00102kbytes sf_vdsiz_2k 01004kbytes sf_vdsiz_4k 10008kbytes sf_vdsiz_8k others reserved ? 0100 0000 AT91X40yyy code label sf_arch_AT91X40 nvptyp type code label sf_nvptyp 0 0 0 reserved ? 001 ? f ? series sf_nvptyp_m 1 x x reserved ? 100 ? r ? series sf_nvptyp_r
97 AT91X40 series 1354d ? atarm ? 05/02 reset status register register name :sf_rsr access type : read only reset value :seebelow offset :0x08  reset: reset status information this field indicates whether the reset was demanded by the external system (via nrst) or by the watchdog internal reset request. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 reset reset cause of reset code label sf_reset 0x6c external pin sf_ext_reset 0x53 internal watchdog sf_wd_reset
98 AT91X40 series 1354d ? atarm ? 05/02 sf memory mode register this register only applies to the at91r40807. register name :sf_mmr access type : read/write reset value :0 offset :0x0c  ramwu: internal extended ram write detection (code label sf_ramwu ) 0 = writing in ram generates an abort. 1=writinginramisallowed. sf protect mode register register name :sf_pmr access type : read/write reset value :0 offset :0x18  pmrkey: protect mode register key (code label sf_pmrkey ) used only when writing sf_pmr. pmrkey is reads 0. 0x27a8: write access in sf_pmr is allowed. other value: write access in sf_pmr is prohibited.  aic: aic protect mode enable (code label sf_aic ) 0 = the advanced interrupt controller runs in normal mode. 1 = the advanced interrupt controller runs in protect mode. see ? protect mode ? on page 60. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? ramwu 31 30 29 28 27 26 25 24 pmrkey 23 22 21 20 19 18 17 16 pmrkey 15 14 13 12 11 10 9 8 ???????? 76543210 ?? aic ?????
99 AT91X40 series 1354d ? atarm ? 05/02 usart: universal synchronous/ asynchronous receiver/ transmitter the AT91X40 series provides two identical, full-duplex, universal synchronous/asyn- chronous receiver/transmitters that interface to the apb and are connected to the peripheral data controller. the main features are:  programmable baud rate generator  parity, framing and overrun error detection  line break generation and detection  automatic echo, local loopback and remote loopback channel modes  multi-drop mode: address detection and generation  interrupt generation  two dedicated peripheral data controller channels  5-, 6-, 7-, 8- and 9-bit character length figure 36. usart block diagram pin description each usart channel has the following external signals: notes: 1. after a hardware reset, the usart pins are not enabled by default (see ? pio: parallel i/o controller ? on page 74). the user must configure the pio controller before enabling the transmitter or receiver. 2. if the user selects one of the internal clocks, sck can be configured as a pio. peripheral data controller receiver channel transmitter channel control logic interrupt control baud rate generator receiver transmitter amba asb apb usxirq mck mck/8 rxd txd sck usart channel baud rate clock pio: parallel i/o controller name description sck usart serial clock can be configured as input or output: sck is configured as input if an external clock is selected (usclks[1] = 1) sck is driven as output if the external clock is disabled (usclks[1] = 0) and clock output is enabled (clko = 1) txd transmit serial data is an output rxd receive serial data is an input
100 AT91X40 series 1354d ? atarm ? 05/02 baud rate generator the baud rate generator provides the bit period clock (the baud rate clock) to both the receiver and the transmitter. the baud rate generator can select between external and internal clock sources. the external clock source is sck. the internal clock sources can be either the master clock (mck) or the master clock divided by 8 (mck/8). note: in all cases, if an external clock is used, the duration of each of its levels must be longer than the system clock (mck) period. the external clock frequency must be at least 2.5 times lower than the system clock. when the usart is programmed to operate in asynchronous mode (sync = 0 in the mode register us_mr), the selected clock is divided by 16 times the value (cd) written in us_brgr (baud rate generator register). if us_brgr is set to 0, the baud rate clock is disabled. when the usart is programmed to operate in synchronous mode (sync = 1) and the selected clock is internal (usclks[1] = 0 in the mode register us_mr), the baud rate clock is the internal selected clock divided by the value written in us_brgr. if us_brgr is set to 0, the baud rate clock is disabled. in synchronous mode with external clock selected (usclks[1] = 1), the clock is pro- vided directly by the signal on the sck pin. no division is active. the value written in us_brgr has no effect. figure 37. baud rate generator baud rate = selected clock 16 x cd baud rate = selected clock cd usclks [1] 0 0 1 1 mck mck/8 sck clk 16-bit counter 0 0 1 baud rate clock sync usclks [1] cd cd out 0 1 divide by 16 sync 0 1 >1 usclks [0]
101 AT91X40 series 1354d ? atarm ? 05/02 receiver asynchronous receiver the usart is configured for asynchronous operation when sync = 0 (bit 7 of us_mr). in asynchronous mode, the usart detects the start of a received character by sampling the rxd signal until it detects a valid start bit. a low level (space) on rxd is interpreted as a valid start bit if it is detected for more than 7 cycles of the sampling clock, which is 16 times the baud rate. hence a space which is longer than 7/16 of the bit period is detected as a valid start bit. a space which is 7/16 of a bit period or shorter is ignored and the receiver continues to wait for a valid start bit. when a valid start bit has been detected, the receiver samples the rxd at the theoreti- cal mid-point of each bit. it is assumed that each bit lasts 16 cycles of the sampling clock (one bit period) so the sampling point is 8 cycles (0.5 bit periods) after the start of the bit. the first sampling point is therefore 24 cycles (1.5 bit periods) after the falling edge of the start bit was detected. each subsequent bit is sampled 16 cycles (1 bit period) after the previous one. figure 38. asynchronous mode: start bit detection figure 39. asynchronous mode: character reception 16 x baud rate clock rxd true start detection d0 sampling d0 d1 d2 d3 d4 d5 d6 d7 rxd true start detection sampling parity bit stop bit example: 8-bit, parity enabled 1 stop 1 bit period 0.5 bit periods
102 AT91X40 series 1354d ? atarm ? 05/02 synchronous receiver when configured for synchronous operation (sync = 1), the receiver samples the rxd signal on each rising edge of the baud rate clock. if a low level is detected, it is consid- ered as a start. data bits, parity bit and stop bit are sampled and the receiver waits for the next start bit. see example in figure 40. figure 40. synchronous mode: character reception receiver ready when a complete character is received, it is transferred to the us_rhr and the rxrdy status bit in us_csr is set. if us_rhr has not been read since the last transfer, the ovre status bit in us_csr is set. parity error each time a character is received, the receiver calculates the parity of the received data bits, in accordance with the field par in us_mr. it then compares the result with the received parity bit. if different, the parity error bit pare in us_csr is set. framing error if a character is received with a stop bit at low level and with at least one data bit at high level, a framing error is generated. this sets frame in us_csr. time-out this function allows an idle condition on the rxd line to be detected. the maximum delay for which the usart should wait for a new character to arrive while the rxd line is inactive (high level) is programmed in us_rtor (receiver time-out). when this reg- ister is set to 0, no time-out is detected. otherwise, the receiver waits for a first character and then initializes a counter which is decremented at each bit period and reloaded at each byte reception. when the counter reaches 0, the timeout bit in us_csr is set. the user can restart the wait for a first character with the sttto (start time-out) bit in us_cr. calculation of time-out duration: d0 d1 d2 d3 d4 d5 d6 d7 rxd true start detection sampling parity bit stop bit example: 8-bit, parity enabled 1 stop sck duration = value x 4 x bit period
103 AT91X40 series 1354d ? atarm ? 05/02 transmitter the transmitter has the same behavior in both synchronous and asynchronous operat- ing modes. start bit, data bits, parity bit and stop bits are serially shifted, lowest significant bit first, on the falling edge of the serial clock. see example in figure 41. the number of data bits is selected in the chrl field in us_mr. the parity bit is set according to the par field in us_mr. the number of stop bits is selected in the nbstop field in us_mr. when a character is written to us_thr (transmit holding), it is transferred to the shift register as soon as it is empty. when the transfer occurs, the txrdy bit in us_csr is set until a new character is written to us_thr. if transmit shift register and us_thr are both empty, the txempty bit in us_csr is set. time-guard the time-guard function allows the transmitter to insert an idle state on the txd line between two characters. the duration of the idle state is programmed in us_ttgr (transmitter time-guard). when this register is set to zero, no time-guard is generated. otherwise, the transmitter holds a high level on txd after each transmitted byte during the number of bit periods programmed in us_ttgr multi-drop mode when the field par in us_mr equals 11x (binary value), the usart is configured to run in multi-drop mode. in this case, the parity error bit pare in us_csr is set when data is detected with a parity bit set to identify an address byte. pare is cleared with the reset status bits command (rststa) in us_cr. if the parity bit is detected low, iden- tifying a data byte, pare is not set. the transmitter sends an address byte (parity bit set) when a send address command (senda) is written to us_cr. in this case, the next byte written to us_thr will be transmitted as an address. after this any byte transmitted will have the parity bit cleared. figure 41. synchronous and asynchronous modes: character transmission idle state duration between two characters = time-guard value x bit period d0 d1 d2 d3 d4 d5 d6 d7 txd start bit parity bit stop bit example: 8-bit, parity enabled 1 stop baud rate clock
104 AT91X40 series 1354d ? atarm ? 05/02 break a break condition is a low signal level which has a duration of at least one character (including start/stop bits and parity). transmit break the transmitter generates a break condition on the txd line when sttbrk is set in us_cr (control register). in this case, the character present in the transmit shift reg- ister is completed before the line is held low. to cancel a break condition on the txd line, the stpbrk command in us_cr must be set. the usart completes a minimum break duration of one character length. the txd line then returns to high level (idle state) for at least 12 bit periods to ensure that the end of break is correctly detected. then the transmitter resumes normal operation. the break is managed like a character:  the sttbrk and the stpbrk commands are performed only if the transmitter is ready (bit txrdy = 1 in us_csr)  the sttbrk command blocks the transmitter holding register (bit txrdy is cleared in us_csr) until the break has started  a break is started when the shift register is empty (any previous character is fully transmitted). txempty is cleared in us_csr. the break blocks the transmitter shift register until it is completed (high level for at least 12-bit periods after the stpbrk command is requested) in order to avoid unpredictable states:  sttbrk and stpbrk commands must not be requested at the same time  once an sttbrk command is requested, further sttbrk commands are ignored until the break is ended (high level for at least 12-bit periods)  all stpbrk commands requested without a previous sttbrk command are ignored  a byte written into the transmit holding register while a break is pending but not started (us_csr.txrdy = 0) is ignored  it is not permitted to write new data in the transmit holding register while a break is in progress (stpbrk has not been requested), even though txrdy = 1 in us_csr.  anewsttbrkcommand must not be issued until an existing break has ended (txempty = 1 in us_csr) the standard break transmission sequence is: 1. wait for the transmitter ready (us_csr.txrdy = 1) 2. send the sttbrk command (write 0x0200 to us_cr) 3. wait for the transmitter ready (txrdy = 1 in us_csr) 4. send the stpbrk command (write 0x0400 to us_cr) the next byte can then be sent: 5. wait for the transmitter ready (txrdy = 1 in us_csr) 6. send the next byte (write byte to us_thr)
105 AT91X40 series 1354d ? atarm ? 05/02 each of these steps can be scheduled by using the interrupt if the bit txrdy in us_imr is set. for character transmission, the usart channel must be enabled before sending a break. receive break the receiver detects a break condition when all data, parity and stop bits are low. when the low stop bit is detected, the receiver asserts the rxbrk bit in us_csr. an end of receive break is detected by a high level for at least 2/16 of a bit period in asynchronous mode or at least one sample in synchronous mode. rxbrk is also asserted when an end of break is detected. both the beginning and the end of a break can be detected by interrupt if the bit us_imr.rxbrk is set. peripheral data controller each usart channel is closely connected to a corresponding peripheral data control- ler channel. one is dedicated to the receiver. the other is dedicated to the transmitter. note: the pdc is disabled if 9-bit character length is selected (mode9 = 1) in us_mr. the pdc channel is programmed using us_tpr (transmit pointer) and us_tcr (transmit counter) for the transmitter and us_rpr (receive pointer) and us_rcr (receive counter) for the receiver. the status of the pdc is given in us_csr by the endtx bit for the transmitter and by the endrx bit for the receiver. the pointer registers (us_tpr and us_rpr) are used to store the address of the transmit or receive buffers. the counter registers (us_tcr and us_rcr) are used to store the size of these buffers. the receiver data transfer is triggered by the rxrdy bit and the transmitter data trans- fer is triggered by txrdy. when a transfer is performed, the counter is decremented and the pointer is incremented. when the counter reaches 0, the status bit is set (endrx for the receiver, endtx for the transmitter in us_csr) which can be pro- grammed to generate an interrupt. transfers are then disabled until a new non-zero counter value is programmed. interrupt generation each status bit in us_csr has a corresponding bit in us_ier (interrupt enable) and us_idr (interrupt disable) which controls the generation of interrupts by asserting the usart interrupt line connected to the advanced interrupt controller. us_imr (interrupt mask register) indicates the status of the corresponding bits. whenabitissetinus_csrandthesamebitissetinus_imr,theinterruptlineis asserted. channel modes the usart can be programmed to operate in three different test modes, using the field chmode in us_mr. automatic echo mode allows bit by bit re-transmission. when a bit is received on the rxd line, it is sent to the txd line. programming the transmitter has no effect. local loopback mode allows the transmitted characters to be received. txd and rxd pins are not used and the output of the transmitter is internally connected to the input of the receiver. the rxd pin level has no effect and the txd pin is held high, as in idle state. remote loopback mode directly connects the rxd pin to the txd pin. the transmitter and the receiver are disabled and have no effect. this mode allows bit by bit re- transmission.
106 AT91X40 series 1354d ? atarm ? 05/02 figure 42. channel modes receiver transmitter disabled rxd txd receiver transmitter disabled rxd txd v dd disabled receiver transmitter disabled rxd txd disabled automatic echo local loopback remote loopback v dd
107 AT91X40 series 1354d ? atarm ? 05/02 usart user interface base address usart0 : 0xfffd0000 (code label usart0_base ) base address usart1 : 0xfffcc000 (code label usart1_base ) table 1 5. usart memory map offset register name access reset state 0x00 control register us_cr write only ? 0x04 mode register us_mr read/write 0 0x08 interrupt enable register us_ier write only ? 0x0c interrupt disable register us_idr write only ? 0x10 interrupt mask register us_imr read only 0 0x14 channel status register us_csr read only 0x18 0x18 receiver holding register us_rhr read only 0 0x1c transmitter holding register us_thr write only ? 0x20 baud rate generator register us_brgr read/write 0 0x24 receiver time-out register us_rtor read/write 0 0x28 transmitter time-guard register us_ttgr read/write 0 0x2c reserved ??? 0x30 receive pointer register us_rpr read/write 0 0x34 receive counter register us_rcr read/write 0 0x38 transmit pointer register us_tpr read/write 0 0x3c transmit counter register us_tcr read/write 0
108 AT91X40 series 1354d ? atarm ? 05/02 usart control register name :us_cr access type :write only offset :0x00  rstrx: reset receiver (code label us_rstrx ) 0=noeffect. 1 = the receiver logic is reset.  rsttx: reset transmitter (code label us_rsttx ) 0=noeffect. 1 = the transmitter logic is reset.  rxen: receiver enable (code label us_rxen ) 0=noeffect. 1 = the receiver is enabled if rxdis is 0.  rxdis: receiver disable (code label us_rxdis ) 0=noeffect. 1 = the receiver is disabled.  txen: transmitter enable (code label us_txen ) 0=noeffect. 1 = the transmitter is enabled if txdis is 0.  txdis: transmitter disable (code label us_txdis ) 0=noeffect. 1 = the transmitter is disabled.  rststa: reset status bits (code label us_rststa ) 0=noeffect. 1 = resets the status bits pare, frame, ovre and rxbrk in the us_csr.  sttbrk: start break (code label us_sttbrk ) 0=noeffect. 1 = if break is not being transmitted, start transmission of a break after the characters present in us_thr and the transmit shift register have been transmitted.  stpbrk: stop break (code label us_stpbrk ) 0=noeffect. 1 = if a break is being transmitted, stop transmission of the break after a minimum of one character length and transmit a high level during 12 bit periods. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ??? senda sttto stpbrk sttbrk rststa 76543210 txdis txen rxdis rxen rsttx rstrx ??
109 AT91X40 series 1354d ? atarm ? 05/02  sttto: start time-out (code label us_sttto ) 0=noeffect. 1 = start waiting for a character before clocking the time-out counter.  senda: send address (code label us_senda ) 0=noeffect. 1 = in multi-drop mode only, the next character written to the us_thr is sent with the address bit set.
110 AT91X40 series 1354d ? atarm ? 05/02 usart mode register name :us_mr access type :read/write reset value :0 offset :0x04  usclks: clock selection (baud rate generator input clock)  chrl: character length start, stop and parity bits are added to the character length.  sync: synchronous mode select (code label us_sync ) 0 = usart operates in asynchronous mode. 1 = usart operates in synchronous mode. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? clko mode9 ? 15 14 13 12 11 10 9 8 chmode nbstop par sync 76543210 chrl usclks ???? usclks selected clock code label us_clks 00mck us_clks_mck 01mck/8 us_clks_mck8 1 x external (sck) us_clks_sck chrl character length code label us_chrl 00fivebits us_chrl_5 01sixbits us_chrl_6 10sevenbits us_chrl_7 11eightbits us_chrl_8
111 AT91X40 series 1354d ? atarm ? 05/02  pa r : pa r it y ty p e  nbstop: number of stop bits the interpretation of the number of stop bits depends on sync.  chmode: channel mode  mode9: 9-bit character length (code label us_mode9 ) 0 = chrl defines character length. 1 = 9-bit character length.  cklo: clock output select (code label us_clko ) 0 = the usart does not drive the sck pin. 1 = the usart drives the sck pin if usclks[1] is 0. pa r par it y ty p e code label us_par 000evenparity us_par_even 001oddparity us_par_odd 0 1 0 parity forced to 0 (space) us_par_space 0 1 1 parity forced to 1 (mark) us_par_mark 1 0 x no parity us_par_no 1 1 x multi-drop mode us_par_multidrop nbstop asynchronous (sync = 0) synchronous (sync = 1) code label us_nbstop 0 0 1stopbit 1stopbit us_nbstop_1 0 1 1.5 stop bits reserved us_nbstop_1_5 1 0 2stopbits 2stopbits us_nbstop_2 1 1 reserved reserved ? chmode mode description code label us_chmode 00 normal mode the usart channel operates as an rx/tx usart. us_chmode_normal 01 automatic echo receiver data input is connected to txd pin. us_chmode_automatic_echo 10 local loopback transmitter output signal is connected to receiver input signal. us_chmode_local_loopback 11 remote loopback rxd pin is internally connected to txd pin. us_chmode_remode_loopback
112 AT91X40 series 1354d ? atarm ? 05/02 usart interrupt enable register name :us_ier access type :write only offset :0x08  rxrdy: enable rxrdy interrupt (code label us_rxrdy ) 0=noeffect. 1 = enables rxrdy interrupt.  txrdy: enable txrdy interrupt (code label us_txrdy ) 0=noeffect. 1 = enables txrdy interrupt.  rxbrk: enable receiver break interrupt (code label us_rxbrk ) 0=noeffect. 1 = enables receiver break interrupt.  endrx: enable end of receive transfer interrupt (code label us_endrx ) 0=noeffect. 1 = enables end of receive transfer interrupt.  endtx: enable end of transmit interrupt (code label us_endtx ) 0=noeffect. 1 = enables end of transmit interrupt.  ovre: enable overrun error interrupt (code label us_ovre ) 0=noeffect. 1 = enables overrun error interrupt.  frame: enable framing error interrupt (code label us_frame ) 0=noeffect. 1 = enables framing error interrupt.  pare: enable parity error interrupt (code label us_pare ) 0=noeffect. 1 = enables parity error interrupt.  timeout: enable time-out interrupt (code label us_timeout ) 0=noeffect. 1 = enables reception time-out interrupt.  txempty: enable txempty interrupt (code label us_txempty ) 0=noeffect. 1 = enables txempty interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? txempty timeout 76543210 pare frame ovre endtx endrx rxbrk txrdy rxrdy
113 AT91X40 series 1354d ? atarm ? 05/02 usart interrupt disable register name :us_idr access type :write only offset :0x0c  rxrdy: disable rxrdy interrupt (code label us_rxrdy ) 0=noeffect. 1 = disables rxrdy interrupt.  txrdy: disable txrdy interrupt (code label us_txrdy ) 0=noeffect. 1 = disables txrdy interrupt.  rxbrk: disable receiver break interrupt (code label us_rxbrk ) 0=noeffect. 1 = disables receiver break interrupt.  endrx: disable end of receive transfer interrupt (code label us_endrx ) 0=noeffect. 1 = disables end of receive transfer interrupt.  endtx: disable end of transmit interrupt (code label us_endtx ) 0=noeffect. 1 = disables end of transmit interrupt.  ovre: disable overrun error interrupt (code label us_ovre ) 0=noeffect. 1 = disables overrun error interrupt.  frame: disable framing error interrupt (code label us_frame ) 0=noeffect. 1 = disables framing error interrupt.  pare: disable parity error interrupt (code label us_pare ) 0=noeffect. 1 = disables parity error interrupt.  timeout: disable time-out interrupt (code label us_timeout ) 0=noeffect. 1 = disables receiver time-out interrupt.  txempty: disable txempty interrupt (code label us_txempty ) 0=noeffect. 1 = disables txempty interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? txempty timeout 76543210 pare frame ovre endtx endrx rxbrk txrdy rxrdy
114 AT91X40 series 1354d ? atarm ? 05/02 usart interrupt mask register name :us_imr access type :read only reset value :0 offset :0x10  rxrdy: mask rxrdy interrupt (code label us_rxrdy ) 0 = rxrdy interrupt is disabled 1 = rxrdy interrupt is enabled  txrdy: mask txrdy interrupt (code label us_txrdy ) 0 = txrdy interrupt is disabled 1 = txrdy interrupt is enabled  rxbrk: mask receiver break interrupt (code label us_rxbrk ) 0 = receiver break interrupt is disabled 1 = receiver break interrupt is enabled  endrx: mask end of receive transfer interrupt (code label us_endrx ) 0 = end of receive transfer interrupt is disabled 1 = end of receive transfer interrupt is enabled  endtx: mask end of transmit interrupt (code label us_endtx ) 0 = end of transmit interrupt is disabled 1 = end of transmit interrupt is enabled  ovre: mask overrun error interrupt (code label us_ovre ) 0 = overrun error interrupt is disabled 1 = overrun error interrupt is enabled  frame: mask framing error interrupt (code label us_frame ) 0 = framing error interrupt is disabled 1 = framing error interrupt is enabled  pare: mask parity error interrupt (code label us_pare ) 0 = parity error interrupt is disabled 1 = parity error interrupt is enabled  timeout: mask time-out interrupt (code label us_timeout ) 0 = receive time-out interrupt is disabled 1 = receive time-out interrupt is enabled  txempty: mask txempty interrupt (code label us_txempty ) 0 = txempty interrupt is disabled. 1 = txempty interrupt is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? txempty timeout 76543210 pare frame ovre endtx endrx rxbrk txrdy rxrdy
115 AT91X40 series 1354d ? atarm ? 05/02 usart channel status register name :us_csr access type :read only reset value :0x18 offset :0x14  rxrdy: receiver ready (code label us_rxrdy ) 0 = no complete character has been received since the last read of the us_rhr or the receiver is disabled. 1 = at least one complete character has been received and the us_rhr has not yet been read.  txrdy: transmitter ready (code label us_txrdy ) 0 = us_thr contains a character waiting to be transferred to the transmit shift register, or an sttbrk command has been requested. 1 = us_thr is empty and there is no break request pending tsr availability. equal to zero when the usart is disabled or at reset. transmitter enable command (in us_cr) sets this bit to one.  rxbrk: break received/end of break (code label us_rxbrk ) 0 = no break received nor end of break has been detected since the last ? reset status bits ? command in the control register. 1 = break received or end of break has been detected since the last ? reset status bits ? command in the control register.  endrx: end of receiver transfer (code label us_endrx ) 0 = the end of transfer signal from the peripheral data controller channel dedicated to the receiver is inactive. 1 = the end of transfer signal from the peripheral data controller channel dedicated to the receiver is active.  endtx: end of transmitter transfer (code label us_endtx ) 0 = the end of transfer signal from the peripheral data controller channel dedicated to the transmitter is inactive. 1 = the end of transfer signal from the peripheral data controller channel dedicated to the transmitter is active.  ovre: overrun error (code label us_ovre ) 0 = no byte has been transferred from the receive shift register to the us_rhr when rxrdy was asserted since the last ? reset status bits ? command. 1 = at least one byte has been transferred from the receive shift register to the us_rhr when rxrdy was asserted since the last ? reset status bits ? command.  frame: framing error (code label us_frame ) 0 = no stop bit has been detected low since the last ? reset status bits ? command. 1 = at least one stop bit has been detected low since the last ? reset status bits ? command. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? txempty timeout 76543210 pare frame ovre endtx endrx rxbrk txrdy rxrdy
116 AT91X40 series 1354d ? atarm ? 05/02  pare: parity error (code label us_pare ) 1 = at least one parity bit has been detected false (or a parity bit high in multi-drop mode) since the last ? reset status bits ? command. 0 = no parity bit has been detected false (or a parity bit high in multi-drop mode) since the last ? reset status bits ? command.  timeout: receiver time-out (code label us_timeout ) 0 = there has not been a time-out since the last ? start time-out ? command or the time-out register is 0. 1 = there has been a time-out since the last ? start time-out ? command.  txempty: transmitter empty (code label us_txempty ) 0 = there are characters in either us_thr or the transmit shift register or a break is being transmitted. 1 = there are no characters in us_thr and the transmit shift register and break is not active. equal to zero when the usart is disabled or at reset. transmitter enable command (in us_cr) sets this bit to one.
117 AT91X40 series 1354d ? atarm ? 05/02 usart receiver holding register name : us_rhr access type :read only reset value :0 offset :0x18  rxchr: received character last character received if rxrdy is set. when number of data bits is less than 8 bits, the bits are right-aligned. all non-significant bits read zero. usart transmitter holding register name :us_thr access type :write only offset :0x1c  txchr: character to be transmitted next character to be transmitted after the current character if txrdy is not set. when number of data bits is less than 8 bits, the bits are right-aligned. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 rxchr 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 txchr
118 AT91X40 series 1354d ? atarm ? 05/02 usart baud rate generator register name : us_brgr access type :read/write reset value :0 offset :0x20  cd: clock divisor this register has no effect if synchronous mode is selected with an external clock. notes: 1. clock divisor bypass (cd = 1) must not be used when internal clock mck is selected (usclks = 0). 2. in synchronous mode, the value programmed must be even to ensure a 50:50 mark:space ratio. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 cd 76543210 cd cd effect 0 disables clock 1 clock divisor bypass (1) 2 to 65535 baud rate (asynchronous mode) = selected clock / (16 x cd) baud rate (synchronous mode) = selected clock / cd (2)
119 AT91X40 series 1354d ? atarm ? 05/02 usart receiver time-out register name :us_rtor access type :read/write reset value :0 offset :0x24  to: time-out value when a value is written to this register, a start time-out command is automatically performed. time-out duration = to x 4 x bit period usart transmitter time-guard register name :us_ttgr access type :read/write reset value :0 offset :0x28  tg: time-guard value time-guard duration = tg x bit period 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 to to 0 disables the rx time-out function. 1 - 255 the time-out counter is loaded with to when the start time-out command is given or when each new data character is received (after reception has started). 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 tg tg 0 disables the tx time-guard function. 1 - 255 txd is inactive high after the transmission of each character for the time-guard duration.
120 AT91X40 series 1354d ? atarm ? 05/02 usart receive pointer register name :us_rpr access type :read/write reset value :0 offset :0x30  rxptr: receive pointer rxptr must be loaded with the address of the receive buffer. usart receive counter register name : us_rcr access type :read/write reset value :0 offset :0x34  rxctr: receive counter rxctr must be loaded with the size of the receive buffer. 0: stop peripheral data transfer dedicated to the receiver. 1 - 65535: start peripheral data transfer if rxrdy is active. 31 30 29 28 27 26 25 24 rxptr 23 22 21 20 19 18 17 16 rxptr 15 14 13 12 11 10 9 8 rxptr 76543210 rxptr 31 30 29 28 27 26 25 24 ???????? 23 22 21 4920 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 rxctr 76543210 rxctr
121 AT91X40 series 1354d ? atarm ? 05/02 usart transmit pointer register name :us_tpr access type :read/write reset value :0 offset :0x38  txptr: transmit pointer txptr must be loaded with the address of the transmit buffer. usart transmit counter register name :us_tcr access type :read/write reset value :0 offset :0x3c  txctr: transmit counter txctr must be loaded with the size of the transmit buffer. 0: stop peripheral data transfer dedicated to the transmitter. 1 - 65535: start peripheral data transfer if txrdy is active. 31 30 29 28 27 26 25 24 txptr 23 22 21 20 19 18 17 16 txptr 15 14 13 12 11 10 9 8 txptr 76543210 txptr 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 txctr 76543210 txctr
122 AT91X40 series 1354d ? atarm ? 05/02 tc: timer counter the AT91X40 series features a timer counter block which includes three identical 16- bit timer counter channels. each channel can be independently programmed to perform a wide range of functions including frequency measurement, event counting, interval measurement, pulse generation, delay timing and pulse width modulation. each timer counter channel has 3 external clock inputs, 5 internal clock inputs, and 2 multi-purpose input/output signals which can be configured by the user. each channel drives an internal interrupt signal which can be programmed to generate processor interrupts via the aic (advanced interrupt controller). the timer counter block has two global registers which act upon all three tc channels. the block control register allows the three channels to be started simultaneously with the same instruction. the block mode register defines the external clock inputs for each timer counter channel, allowing them to be chained. figure 43. tc block diagram timer counter channel 0 timer counter channel 1 timer counter channel 2 sync parallel io controller tc1xc1s tc0xc0s tc2xc2s int int int tioa0 tioa1 tioa2 tiob0 tiob1 tiob2 xc0 xc1 xc2 xc0 xc1 xc2 xc0 xc1 xc2 tclk0 tclk1 tclk2 tclk0 tclk1 tclk2 tclk0 tclk1 tclk2 tioa1 tioa2 tioa0 tioa2 tioa0 tioa1 advanced interrupt controller tclk0 tclk1 tclk2 tioa0 tiob0 tioa1 tiob1 tioa2 tiob2 timer counter block tioa tiob tioa tiob tioa tiob sync sync mck/2 mck/8 mck/32 mck/128 mck/1024
123 AT91X40 series 1354d ? atarm ? 05/02 signal name description note: after a hardware reset, the timer counter block pins are controlled by the pio controller. they must be configured to be con- trolled by the peripheral before being used. timer counter description the three timer counter channels are independent and identical in operation. the reg- isters for channel programming are listed in table 17. counter each timer counter channel is organized around a 16-bit counter. the value of the counter is incremented at each positive edge of the selected clock. when the counter has reached the value 0xffff and passes to 0x0000, an overflow occurs and the bit covfs in tc_sr (status register) is set. the current value of the counter is accessible in real-time by reading tc_cv. the counter can be reset by a trigger. in this case, the counter value passes to 0x0000 on the next valid edge of the selected clock. clock selection at block level, input clock signals of each channel can either be connected to the exter- nal inputs tclk0, tclk1 or tclk2, or be connected to the configurable i/o signals tioa0, tioa1 or tioa2 for chaining by programming the tc_bmr (block mode). each channel can independently select an internal or external clock source for its counter:  internal clock signals: mck/2, mck/8, mck/32, mck/128, mck/1024  external clock signals: xc0, xc1 or xc2 channel signal description xc0, xc1, xc2 external clock inputs tioa capture mode: general purpose input waveform mode: general purpose output tiob capture mode: general purpose input waveform mode: general purpose input/output int interrupt signal output sync synchronization input signal block signals description tclk0, tclk1, tclk2 external clock inputs tioa0 tioa signal for channel 0 tiob0 tiob signal for channel 0 tioa1 tioa signal for channel 1 tiob1 tiob signal for channel 1 tioa2 tioa signal for channel 2 tiob2 tiob signal for channel 2
124 AT91X40 series 1354d ? atarm ? 05/02 the selected clock can be inverted with the clki bit in tc_cmr (channel mode). this allows counting on the opposite edges of the clock. the burst function allows the clock to be validated when an external signal is high. the burst parameter in the mode register defines this signal (none, xc0, xc1, xc2). note: in all cases, if an external clock is used, the duration of each of its levels must be longer than the system clock (mck) period. the external clock frequency must be at least 2.5 times lower than the system clock (mck). figure 44. clock selection clock control the clock of each counter can be controlled in two different ways: it can be enabled/dis- abled and started/stopped.  the clock can be enabled or disabled by the user with the clken and the clkdis commands in the control register. in capture mode it can be disabled by an rb load event if ldbdis is set to 1 in tc_cmr. in waveform mode, it can be disabled by an rc compare event if cpcdis is set to 1 in tc_cmr. when disabled, the start or the stop actions have no effect: only a clken command in the control register can re-enable the clock. when the clock is enabled, the clksta bit is set in the status register.  the clock can also be started or stopped : a trigger (software, synchro, external or compare) always starts the clock. the clock can be stopped by an rb load event in capture mode (ldbstop = 1 in tc_cmr) or a rc compare event in waveform mode (cpcstop = 1 in tc_cmr). the start and the stop commands have effect only if the clock is enabled. mck/2 mck/8 mck/32 mck/128 mck/1024 xc0 xc1 xc2 clks clki burst 1 selected clock
125 AT91X40 series 1354d ? atarm ? 05/02 figure 45. clock control timer counter operating modes each timer counter channel can independently operate in two different modes:  capture mode allows measurement on signals  waveform mode allows wave generation the timer counter operating mode is programmed with the wave bit in the tc mode register. in capture mode, tioa and tiob are configured as inputs. in waveform mode, tioa is always configured to be an output and tiob is an output if it is not selected to be the external trigger. trigger a trigger resets the counter and starts the counter clock. three types of triggers are common to both modes, and a fourth external trigger is available to each mode. the following triggers are common to both modes:  software trigger: each channel has a software trigger, available by setting swtrg in tc_ccr.  sync: each channel has a synchronization signal sync. when asserted, this signal has the same effect as a software trigger. the sync signals of all channels are asserted simultaneously by writing tc_bcr (block control) with sync set.  compare rc trigger: rc is implemented in each channel and can provide a trigger when the counter value matches the rc value if cpctrg is set in tc_cmr. the timer counter channel can also be configured to have an external trigger. in cap- ture mode, the external trigger signal can be selected between tioa and tiob. in waveform mode, an external event can be programmed on one of the following signals: tiob, xc0, xc1 or xc2. this external event can then be programmed to perform a trig- ger by setting enetrg in tc_cmr. if an external trigger is used, the duration of the pulses must be longer than the system clock (mck) period in order to be detected. whatever the trigger used, it will be taken into account at the following active edge of the selected clock. this means that the counter value may not read zero just after a trigger, especially when a low frequency signal is selected as the clock. qs r s r q clksta clken clkdis stop event disable event counter clock selected clock trigger
126 AT91X40 series 1354d ? atarm ? 05/02 capture operating mode this mode is entered by clearing the wave parameter in tc_cmr (channel mode register). capture mode allows the tc channel to perform measurements such as pulse timing, frequency, period, duty cycle and phase on tioa and tiob signals which are inputs. figure 46 shows the configuration of the tc channel when programmed in capture mode. capture registers a and b (ra and rb) registers a and b are used as capture registers. this means that they can be loaded with the counter value when a programmable event occurs on the signal tioa. the parameter ldra in tc_cmr defines the tioa edge for the loading of register a, and the parameter ldrb defines the tioa edge for the loading of register b. ra is loaded only if it has not been loaded since the last trigger or if rb has been loaded since the last loading of ra. rb is loaded only if ra has been loaded since the last trigger or the last loading of rb. loading ra or rb before the read of the last value loaded sets the overrun error flag (lovrs) in tc_sr (status register). in this case, the old value is overwritten. trigger conditions in addition to the sync signal, the software trigger and the rc compare trigger, an external trigger can be defined. bit abetrg in tc_cmr selects input signal tioa or tiob as an external trigger. parameter etrgedg defines the edge (rising, falling or both) detected to generate an external trigger. if etrgedg = 0 (none), the external trigger is disabled. status register the following bits in the status register are significant in capture operating mode.  cpcs: rc compare status there has been an rc compare match at least once since the last read of the status  covfs: counter overflow status the counter has attempted to count past $ffff since the last read of the status  lovrs: load overrun status ra or rb has been loaded at least twice without any read of the corresponding reg- ister, since the last read of the status  ldras: load ra status ra has been loaded at least once without any read, since the last read of the status  ldrbs: load rb status rb has been loaded at least once without any read, since the last read of the status  etrgs: external trigger status an external trigger on tioa or tiob has been detected since the last read of the status note: all the status bits are set when the corresponding event occurs and they are automati- cally cleared when the status register is read.
127 AT91X40 series 1354d ? atarm ? 05/02 figure 46. capture mode mck/2 mck/8 mck/32 mck/128 mck/1024 xc0 xc1 xc2 tcclks clki qs r s r q clksta clken clkdis burst tiob register c capture register a capture register b compare rc = 16-bit counter abetrg swtrg etrgedg cpctrg tc_imr trig ldrbs ldras etrgs tc_sr lovrs covfs sync 1 mtiob tioa mtioa ldra ldbstop if ra is not loaded or rb is loaded if ra is loaded ldbdis cpcs int edge detector edge detector ldrb edge detector clk ovf reset timer counter channel
128 AT91X40 series 1354d ? atarm ? 05/02 waveform operating mode this mode is entered by setting the wave parameter in tc_cmr (channel mode register). waveform operating mode allows the tc channel to generate 1 or 2 pwm signals with the same frequency and independently programmable duty cycles, or to generate differ- ent types of one-shot or repetitive pulses. in this mode, tioa is configured as output and tiob is defined as output if it is not used as an external event (eevt parameter in tc_cmr). figure 47 shows the configuration of the tc channel when programmed in waveform operating mode. compare register a, b and c (ra, rb, and rc) in waveform operating mode, ra, rb and rc are all used as compare registers. ra compare is used to control the tioa output. rb compare is used to control the tiob (if configured as output). rc compare can be programmed to control tioa and/or tiob outputs. rc compare can also stop the counter clock (cpcstop = 1 in tc_cmr) and/or dis- able the counter clock (cpcdis = 1 in tc_cmr). as in capture mode, rc compare can also generate a trigger if cpctrg = 1. a trigger resets the counter so rc can control the period of pwm waveforms. external event/trigger conditions an external event can be programmed to be detected on one of the clock sources (xc0, xc1, xc2) or tiob. the external event selected can then be used as a trigger. the parameter eevt in tc_cmr selects the external trigger. the parameter eevt- edg defines the trigger edge for each of the possible external triggers (rising, falling or both). if eevtedg is cleared (none), no external event is defined. if tiob is defined as an external event signal (eevt = 0), tiob is no longer used as output and the tc channel can only generate a waveform on tioa. when an external event is defined, it can be used as a trigger by setting bit enetrg in tc_cmr. as in capture mode, the sync signal, the software trigger and the rc compare trigger are also available as triggers.
129 AT91X40 series 1354d ? atarm ? 05/02 output controller the output controller defines the output level changes on tioa and tiob following an event. tiob control is used only if tiob is defined as output (not as an external event). the following events control tioa and tiob: software trigger, external event and rc compare. ra compare controls tioa and rb compare controls tiob. each of these events can be programmed to set, clear or toggle the output as defined in the corre- sponding parameter in tc_cmr. the tables below show which parameter in tc_cmr is used to define the effect of each event. if two or more events occur at the same time, the priority level is defined as follows: 1. software trigger 2. external event 3. rc compare 4. ra or rb compare status the following bits in the status register are significant in waveform mode:  cpas: ra compare status there has been a ra compare match at least once since the last read of the status  cpbs: rb compare status there has been a rb compare match at least once since the last read of the status  cpcs: rc compare status there has been a rc compare match at least once since the last read of the status  covfs: counter overflow counter has attempted to count past $ffff since the last read of the status  etrgs: external trigger external trigger has been detected since the last read of the status note: all the status bits are set when the corresponding event occurs and they are automati- cally cleared when the status register is read. parameter tioa event aswtrg software trigger aeevt external event acpc rc compare acpa ra compare parameter tiob event bswtrg software trigger beevt external event bcpc rc compare bcpb rb compare
130 AT91X40 series 1354d ? atarm ? 05/02 figure 47. waveform mode mck/2 mck/8 mck/32 mck/128 mck/1024 xc0 xc1 xc2 tcclks clki qs r s r q clksta clken clkdis cpcdis burst tiob register a register b register c compare ra = compare rb = compare rc = cpcstop 16-bit counter eevt eevtedg sync swtrg enetrg cpctrg tc_imr trig acpc acpa aeevt aswtrg bcpc bcpb beevt bswtrg tioa mtioa tiob mtiob cpas covfs etrgs tc_sr cpcs cpbs clk ovf reset output controller output controller int 1 edge detector timer counter channel
131 AT91X40 series 1354d ? atarm ? 05/02 tc user interface tc base address : 0xfffe0000 (code label tc_base ) tc_bcr (block control register) and tc_bmr (block mode register) control the tc block. tc channels are controlled by the registers listed in table 17. the offset of each of the channel registers in table 17 is in relation to the offset of the corresponding channel as mentioned in table 16. note: read only if wave = 0 table 1 6. tc global memory map offset channel/register name access reset state 0x00 tc channel 0 see table 17 0x40 tc channel 1 see table 17 0x80 tc channel 2 see table 17 0xc0 tc block control register tc_bcr write only ? 0xc4 tc block mode register tc_bmr read/write 0 table 1 7. tc channel memory map offset register name access reset state 0x00 channel control register tc_ccr write only ? 0x04 channel mode register tc_cmr read/write 0 0x08 reserved ? 0x0c reserved ? 0x10 counter value tc_cv read/write 0 0x14 register a tc_ra read/write (1) 0 0x18 register b tc_rb read/write (1) 0 0x1c register c tc_rc read/write 0 0x20 status register tc_sr read only 0 0x24 interrupt enable register tc_ier write only ? 0x28 interrupt disable register tc_idr write only ? 0x2c interrupt mask register tc_imr read only 0
132 AT91X40 series 1354d ? atarm ? 05/02 tc block control register register name :tc_bcr access type : write only offset :0xc0  sync: synchro command 0=noeffect. 1 = asserts the sync signal which generates a software trigger simultaneously for each of the channels. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? sync
133 AT91X40 series 1354d ? atarm ? 05/02 tc block mode register register name :tc_bmr access type : read/write reset value :0 offset :0xc4  tc0xc0s: external clock signal 0 selection  tc1xc1s: external clock signal 1 selection  tc2xc2s: external clock signal 2 selection 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? tc2xc2s tc1xc1s tc0xc0s tc0xc0s signal connected to xc0 00tclk0 01none 10tioa1 11tioa2 tc1xc1s signal connected to xc1 00tclk1 01none 10tioa0 11tioa2 tc2xc2s signal connected to xc2 00tclk2 01none 10tioa0 11tioa1
134 AT91X40 series 1354d ? atarm ? 05/02 tc channel control register register name : tc_ccr access type : write only offset :0x00  clken: counter clock enable command (code label tc_clken ) 0=noeffect. 1 = enables the clock if clkdis is not 1.  clkdis: counter clock disable command (code label tc_clkdis ) 0=noeffect. 1 = disables the clock.  swtrg: software trigger command (code label tc_swtrg ) 0=noeffect. 1 = a software trigger is performed: the counter is reset and clock is started. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ????? swtrg clkdis clken
135 AT91X40 series 1354d ? atarm ? 05/02 tc channel mode register: capture mode register name : tc_cmr access type : read/write reset value :0 offset :0x04  tcclks: clock selection  clki: clock invert (code label tc_clki ) 0 = counter is incremented on rising edge of the clock. 1 = counter is incremented on falling edge of the clock.  burst: burst signal selection  ldbstop: counter clock stopped with rb loading (code label tc_ldbstop ) 0 = counter clock is not stopped when rb loading occurs. 1 = counter clock is stopped when rb loading occurs. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???? ldrb ldra 15 14 13 12 11 10 9 8 wave = 0 cpctrg ??? abetrg etrgedg 76543210 ldbdis ldbstop burst clki tcclks tcclks clock selected code label tc_clks 000mck/2 tc_clks_mck2 001mck/8 tc_clks_mck8 010mck/32 tc_clks_mck32 011mck/128 tc_clks_mck128 1 0 0 mck/1024 tc_clks_mck1024 101xc0 tc_clks_xc0 110xc1 tc_clks_xc1 111xc2 tc_clks_xc2 burst selected burst code label tc_burst 0 0 the clock is not gated by an external signal tc_burst_none 0 1 xc0isandedwiththeselectedclock tc_burst_xc0 1 0 xc1isandedwiththeselectedclock tc_burst_xc1 1 1 xc2isandedwiththeselectedclock tc_burst_xc2
136 AT91X40 series 1354d ? atarm ? 05/02  ldbdis: counter clock disable with rb loading (code label tc_ldbdis ) 0 = counter clock is not disabled when rb loading occurs. 1 = counter clock is disabled when rb loading occurs.  etrgedg: external trigger edge selection  abetrg: tioa or tiob external trigger selection  cpctrg: rc compare trigger enable (code label tc_cpctrg ) 0 = rc compare has no effect on the counter and its clock. 1 = rc compare resets the counter and starts the counter clock.  wave = 0 (code label tc_wave ) 0 = capture mode is enabled. 1 = capture mode is disabled (waveform mode is enabled).  ldra: ra loading selection  ldrb: rb loading selection etrgedg edge code label tc_etrgedg 0 0 none tc_etrgedg_edge_none 0 1 rising edge tc_etrgedg_rising_edge 1 0 falling edge tc_etrgedg_falling_edge 1 1 each edge tc_etrgedg_both_edge abetrg selected abetrg code label tc_abetrg 0 tiob is used as an external trigger. tc_abetrg_tiob 1 tioa is used as an external trigger. tc_abetrg_tioa ldra edge code label tc_ldra 00none tc_ldra_edge_none 0 1 rising edge of tioa tc_ldra_rising_edge 1 0 falling edge of tioa tc_ldra_falling_edge 1 1 each edge of tioa tc_ldra_both_edge ldrb edge code label tc_ldrb 0 0 none tc_ldrb_edge_none 0 1 rising edge of tioa tc_ldrb_rising_edge 1 0 falling edge of tioa tc_ldrb_falling_edge 1 1 each edge of tioa tc_ldrb_both_edge
137 AT91X40 series 1354d ? atarm ? 05/02 tc channel mode register: waveform mode register name : tc_cmr access type : read/write reset value :0 offset :0x04  tcclks: clock selection  clki: clock invert (code label tc_clki ) 0 = counter is incremented on rising edge of the clock. 1 = counter is incremented on falling edge of the clock.  burst: burst signal selection  cpcstop: counter clock stopped with rc compare (code label tc_cpcstop ) 0 = counter clock is not stopped when counter reaches rc. 1 = counter clock is stopped when counter reaches rc. 31 30 29 28 27 26 25 24 bswtrg beevt bcpc bcpb 23 22 21 20 19 18 17 16 aswtrg aeevt acpc acpa 15 14 13 12 11 10 9 8 wave = 1 cpctrg ? enetrg eevt eevtedg 76543210 cpcdis cpcstop burst clki tcclks tcclks clock selected code label tc_clks 000mck/2 tc_clks_mck2 001mck/8 tc_clks_mck8 010mck/32 tc_clks_mck32 011mck/128 tc_clks_mck128 1 0 0 mck/1024 tc_clks_mck1024 101xc0 tc_clks_xc0 110xc1 tc_clks_xc1 111xc2 tc_clks_xc2 burst selected burst code label tc_burst 0 0 the clock is not gated by an external signal. tc_burst_none 0 1 xc0isandedwiththeselectedclock. tc_burst_xc0 1 0 xc1isandedwiththeselectedclock. tc_burst_xc1 1 1 xc2isandedwiththeselectedclock. tc_burst_xc2
138 AT91X40 series 1354d ? atarm ? 05/02  cpcdis: counter clock disable with rc compare (code label tc_cpcdis ) 0 = counter clock is not disabled when counter reaches rc. 1 = counter clock is disabled when counter reaches rc.  eevtedg: external event edge selection  eevt: external event selection note: if tiob is chosen as the external event signal, it is configured as an input and no longer generates waveforms.  enetrg: external event trigger enable (code label tc_enetrg ) 0 = the external event has no effect on the counter and its clock. in this case, the selected external event only controls the tioa output. 1 = the external event resets the counter and starts the counter clock.  cpctrg: rc compare trigger enable (code label tc_cpctrg ) 0 = rc compare has no effect on the counter and its clock. 1 = rc compare resets the counter and starts the counter clock.  wave = 1 (code label tc_wave ) 0 = waveform mode is disabled (capture mode is enabled). 1 = waveform mode is enabled.  acpa: ra compare effect on tioa eevtedg edge code label tc_eevtedg 0 0 none tc_eevtedg_edge_none 0 1 rising edge tc_eevtedg_rising_edge 1 0 falling edge tc_eevtedg_falling_edge 1 1 each edge tc_eevtedg_both_edge eevt signal selected as external event tiob direction code label tc_eevt 0 0 tiob input (1) tc_eevt_tiob 01xc0 output tc_eevt_xc0 10xc1 output tc_eevt_xc1 11xc2 output tc_eevt_xc2 acpa effect code label tc_acpa 00none tc_acpa_output_none 01set tc_acpa_set_output 1 0 clear tc_acpa_clear_output 1 1 toggle tc_acpa_toggle_output
139 AT91X40 series 1354d ? atarm ? 05/02  acpc: rc compare effect on tioa  aeevt: external event effect on tioa  aswtrg: software trigger effect on tioa  bcpb: rb compare effect on tiob  bcpc: rc compare effect on tiob acpc effect code label tc_acpc 00none tc_acpc_output_none 01set tc_acpc_set_output 1 0 clear tc_acpc_clear_output 1 1 toggle tc_acpc_toggle_output aeevt effect code label tc_aeevt 00none tc_aeevt_output_none 01set tc_aeevt_set_output 1 0 clear tc_aeevt_clear_output 1 1 toggle tc_aeevt_toggle_output aswtrg effect code label tc_aswtrg 0 0 none tc_aswtrg_output_none 01set tc_aswtrg_set_output 10clear tc_aswtrg_clear_output 11toggle tc_aswtrg_toggle_output bcpb effect code label tc_bcpb 00none tc_bcpb_output_none 01set tc_bcpb_set_output 1 0 clear tc_bcpb_clear_output 1 1 toggle tc_bcpb_toggle_output bcpc effect code label tc_bcpc 00none tc_bcpc_output_none 01set tc_bcpc_set_output 1 0 clear tc_bcpc_clear_output 1 1 toggle tc_bcpc_toggle_output
140 AT91X40 series 1354d ? atarm ? 05/02  beevt: external event effect on tiob  bswtrg: software trigger effect on tiob beevt effect code label tc_beevt 0 0 none tc_beevt_output_none 01set tc_beevt_set_output 1 0 clear tc_beevt_clear_output 1 1 toggle tc_beevt_toggle_output bswtrg effect code label tc_bswtrg 0 0 none tc_bswtrg_output_none 01set tc_bswtrg_set_output 1 0 clear tc_bswtrg_clear_output 1 1 toggle tc_bswtrg_toggle_output
141 AT91X40 series 1354d ? atarm ? 05/02 tc counter value register register name : tc_cvr access type : read only reset value :0 offset :0x10  cv: counter value (code label tc_cv ) cv contains the counter value in real-time. tc register a register name : tc_ra access type : read only if wave = 0, read/write if wave = 1 reset value :0 offset :0x14  ra: register a (code label tc_ra ) ra contains the register a value in real-time. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 cv 76543210 cv 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ra 76543210 ra
142 AT91X40 series 1354d ? atarm ? 05/02 tc register b register name : tc_rb access type : read only if wave = 0, read/write if wave = 1 reset value :0 offset :0x18  rb: register b (code label tc_rb ) rb contains the register b value in real-time. tc register c register name : tc_rc access type : read/write reset value :0 offset :0x1c  rc: register c (code label tc_rc ) rc contains the register c value in real-time. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 rb 76543210 rb 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 rc 76543210 rc
143 AT91X40 series 1354d ? atarm ? 05/02 tc status register register name :tc_sr access type : read only reset value :0 offset :0x20  covfs: counter overflow status (code label tc_covfs ) 0 = no counter overflow has occurred since the last read of the status register. 1 = a counter overflow has occurred since the last read of the status register.  lovrs: load overrun status (code label tc_lovrs ) 0 = load overrun has not occurred since the last read of the status register or wave = 1. 1 = ra or rb have been loaded at least twice without any read of the corresponding register since the last read of the sta- tus register, if wave = 0.  cpas: ra compare status (code label tc_cpas ) 0 = ra compare has not occurred since the last read of the status register or wave = 0. 1 = ra compare has occurred since the last read of the status register, if wave = 1.  cpbs: rb compare status (code label tc_cpbs ) 0 = rb compare has not occurred since the last read of the status register or wave = 0. 1 = rb compare has occurred since the last read of the status register, if wave = 1.  cpcs: rc compare status (code label tc_cpcs ) 0 = rc compare has not occurred since the last read of the status register. 1 = rc compare has occurred since the last read of the status register.  ldras: ra loading status (code label tc_ldras ) 0 = ra load has not occurred since the last read of the status register or wave = 1. 1 = ra load has occurred since the last read of the status register, if wave = 0.  ldrbs: rb loading status (code label tc_ldrbs ) 0 = rb load has not occurred since the last read of the status register or wave = 1. 1 = rb load has occurred since the last read of the status register, if wave = 0.  etrgs: external trigger status (code label tc_etrgs ) 0 = external trigger has not occurred since the last read of the status register. 1 = external trigger has occurred since the last read of the status register.  clksta: clock enabling status (code label tc_clksta ) 0 = clock is disabled. 1 = clock is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? mtiob mtioa clksta 15 14 13 12 11 10 9 8 ???????? 76543210 etrgs ldrbs ldras cpcs cpbs cpas lovrs covfs
144 AT91X40 series 1354d ? atarm ? 05/02  mtioa: tioa mirror (code label tc_mtioa ) 0 = tioa is low. if wave = 0, this means that tioa pin is low. if wave = 1, this means that tioa is driven low. 1 = tioa is high. if wave = 0, this means that tioa pin is high. if wave = 1, this means that tioa is driven high.  mtiob: tiob mirror (code label tc_mtiob ) 0 = tiob is low. if wave = 0, this means that tiob pin is low. if wave = 1, this means that tiob is driven low. 1 = tiob is high. if wave = 0, this means that tiob pin is high. if wave = 1, this means that tiob is driven high.
145 AT91X40 series 1354d ? atarm ? 05/02 tc interrupt enable register register name :tc_ier access type : write only offset :0x24  covfs: counter overflow (code label tc_covfs ) 0=noeffect. 1 = enables the counter overflow interrupt.  lovrs: load overrun (code label tc_lovrs ) 0=noeffect. 1: enables the load overrun interrupt.  cpas: ra compare (code label tc_cpas ) 0=noeffect. 1 = enables the ra compare interrupt.  cpbs: rb compare (code label tc_cpbs ) 0=noeffect. 1 = enables the rb compare interrupt.  cpcs: rc compare (code label tc_cpcs ) 0=noeffect. 1 = enables the rc compare interrupt.  ldras: ra loading (code label tc_ldras ) 0=noeffect. 1 = enables the ra load interrupt.  ldrbs: rb loading (code label tc_ldrbs ) 0=noeffect. 1 = enables the rb load interrupt.  etrgs: external trigger (code label tc_etrgs ) 0=noeffect. 1 = enables the external trigger interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 etrgs ldrbs ldras cpcs cpbs cpas lovrs covfs
146 AT91X40 series 1354d ? atarm ? 05/02 tc interrupt disable register register name :tc_idr access type : write only offset :0x28  covfs: counter overflow (code label tc_covfs ) 0=noeffect. 1 = disables the counter overflow interrupt.  lovrs: load overrun (code label tc_lovrs ) 0=noeffect. 1 = disables the load overrun interrupt (if wave = 0).  cpas: ra compare (code label tc_cpas ) 0=noeffect. 1 = disables the ra compare interrupt (if wave = 1).  cpbs: rb compare (code label tc_cpbs ) 0=noeffect. 1 = disables the rb compare interrupt (if wave = 1).  cpcs: rc compare (code label tc_cpcs ) 0=noeffect. 1 = disables the rc compare interrupt.  ldras: ra loading (code label tc_ldras ) 0=noeffect. 1 = disables the ra load interrupt (if wave = 0).  ldrbs: rb loading (code label tc_ldrbs ) 0=noeffect. 1 = disables the rb load interrupt (if wave = 0).  etrgs: external trigger (code label tc_etrgs ) 0=noeffect. 1 = disables the external trigger interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 etrgs ldrbs ldras cpcs cpbs cpas lovrs covfs
147 AT91X40 series 1354d ? atarm ? 05/02 tc interrupt mask register register name :tc_imr access type : read only reset value :0 offset :0x2c  covfs: counter overflow (code label tc_covfs ) 0 = the counter overflow interrupt is disabled. 1 = the counter overflow interrupt is enabled.  lovrs: load overrun (code label tc_lovrs ) 0 = the load overrun interrupt is disabled. 1 = the load overrun interrupt is enabled.  cpas: ra compare (code label tc_cpas ) 0 = the ra compare interrupt is disabled. 1 = the ra compare interrupt is enabled.  cpbs: rb compare (code label tc_cpbs ) 0 = the rb compare interrupt is disabled. 1 = the rb compare interrupt is enabled.  cpcs: rc compare (code label tc_cpcs ) 0 = the rc compare interrupt is disabled. 1 = the rc compare interrupt is enabled.  ldras: ra loading (code label tc_ldras ) 0 = the load ra interrupt is disabled. 1 = the load ra interrupt is enabled.  ldrbs: rb loading (code label tc_ldrbs ) 0 = the load rb interrupt is disabled. 1 = the load rb interrupt is enabled.  etrgs: external trigger (code label tc_etrgs ) 0 = the external trigger interrupt is disabled. 1 = the external trigger interrupt is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 etrgs ldrbs ldras cpcs cpbs cpas lovrs covfs
148 AT91X40 series 1354d ? atarm ? 05/02
i AT91X40 series 1354d ? atarm ? 05/02 table of contents features................................................................................................. 1 description ............................................................................................ 1 pin configuration.................................................................................. 2 block diagram....................................................................................... 4 architectural overview......................................................................... 5 memories .............................................................................................................. 5 peripherals............................................................................................................ 5 associated documentation ................................................................. 7 product overview ................................................................................. 8 power supply........................................................................................................ 8 input/output considerations ................................................................................. 8 master clock......................................................................................................... 8 reset .................................................................................................................... 8 emulation function ............................................................................................... 8 memory controller ................................................................................................ 9 external bus interface ........................................................................................ 11 peripherals .......................................................................................... 11 system peripherals............................................................................................. 12 user peripherals ................................................................................................. 14 memory map........................................................................................ 15 peripheral memory map ..................................................................... 17 ebi: external bus interface................................................................ 18 external memory mapping.................................................................................. 18 external bus interface pin description .............................................................. 20 chip select lines................................................................................................ 21 data bus width................................................................................................... 23 byte write or byte select access ....................................................................... 24 boot on ncs0..................................................................................................... 26 read protocols ................................................................................................... 27 write data hold time ......................................................................................... 28 wait states ......................................................................................................... 29 memory access waveforms ............................................................................... 33 ebi user interface .............................................................................................. 45 ebi chip select register .................................................................................... 46 ebi remap control register .............................................................................. 48 ebi memory control register ............................................................................. 49
ii AT91X40 series 1354d ? atarm ? 05/02 ps: power-saving ............................................................................... 50 peripheral clocks................................................................................................ 50 ps user interface ............................................................................................... 51 ps control register ............................................................................................ 52 ps peripheral clock enable register ................................................................. 53 ps peripheral clock disable register ................................................................ 54 ps peripheral clock status register .................................................................. 55 aic: advanced interrupt controller .................................................. 56 hardware interrupt vectoring.............................................................................. 58 priority controller ................................................................................................ 58 interrupt handling ............................................................................................... 58 interrupt masking ................................................................................................ 58 interrupt clearing and setting............................................................................. 59 fast interrupt request ........................................................................................ 59 software interrupt ............................................................................................... 59 spurious interrupt ............................................................................................... 59 protect mode ...................................................................................................... 60 aic user interface .............................................................................................. 61 aic source mode register ................................................................................. 62 aic source vector register................................................................................ 63 aic interrupt vector register.............................................................................. 64 aic fiq vector register ..................................................................................... 64 aic interrupt status register.............................................................................. 65 aic interrupt pending register ........................................................................... 65 aic interrupt mask register ............................................................................... 66 aic core interrupt status register ..................................................................... 67 aic interrupt enable command register ........................................................... 68 aic interrupt disable command register .......................................................... 68 aic interrupt clear command register.............................................................. 69 aic interrupt set command register ................................................................. 69 aic end of interrupt command register ............................................................ 70 aic spurious vector register............................................................................. 70 standard interrupt sequence.............................................................................. 71 pio: parallel i/o controller................................................................. 74 multiplexed i/o lines .......................................................................................... 74 output selection ................................................................................................. 74 i/o levels............................................................................................................ 74 filters .................................................................................................................. 74 interrupts............................................................................................................. 75 user interface ..................................................................................................... 75 pio user interface .............................................................................................. 78 pio enable register ........................................................................................... 79 pio disable register .......................................................................................... 79 pio status register ............................................................................................ 80
iii AT91X40 series 1354d ? atarm ? 05/02 pio output enable register ............................................................................... 81 pio output disable register .............................................................................. 81 pio output status register ................................................................................ 82 pio input filter enable register ......................................................................... 83 pio input filter disable register ........................................................................ 83 pio input filter status register .......................................................................... 84 pio set output data register ............................................................................ 85 pio clear output data register ......................................................................... 85 pio output data status register........................................................................ 86 pio pin data status register ............................................................................. 86 pio interrupt enable register............................................................................. 87 pio interrupt disable register............................................................................ 87 pio interrupt mask register ............................................................................... 88 pio interrupt status register.............................................................................. 88 wd: watchdog timer ......................................................................... 89 wd user interface .............................................................................................. 90 wd overflow mode register .............................................................................. 90 wd clock mode register ................................................................................... 91 wd control register........................................................................................... 92 wd status register ............................................................................................ 92 wd enabling sequence...................................................................................... 93 sf: special function registers......................................................... 94 chip identification ............................................................................................... 94 sf user interface................................................................................................ 94 chip id register ................................................................................................. 95 chip id extension register................................................................................. 96 reset status register......................................................................................... 97 sf memory mode register................................................................................. 98 sf protect mode register .................................................................................. 98 usart: universal synchronous/asynchronous receiver/transmitter .......................................................................... 99 pin description.................................................................................................... 99 baud rate generator........................................................................................ 100 receiver............................................................................................................ 101 transmitter........................................................................................................ 103 break ................................................................................................................ 104 peripheral data controller ................................................................................ 105 interrupt generation.......................................................................................... 105 channel modes................................................................................................. 105 usart user interface ...................................................................................... 107 usart control register................................................................................... 108 usart mode register ..................................................................................... 110 usart interrupt enable register..................................................................... 112
iv AT91X40 series 1354d ? atarm ? 05/02 usart interrupt disable register.................................................................... 113 usart interrupt mask register ....................................................................... 114 usart channel status register...................................................................... 115 usart receiver holding register................................................................... 117 usart transmitter holding register............................................................... 117 usart baud rate generator register ............................................................ 118 usart receiver time-out register................................................................. 119 usart transmitter time-guard register......................................................... 119 usart receive pointer register..................................................................... 120 usart receive counter register ................................................................... 120 usart transmit pointer register.................................................................... 121 usart transmit counter register .................................................................. 121 tc: timer counter ............................................................................ 122 signal name description ................................................................................. 123 timer counter description................................................................................ 123 capture operating mode .................................................................................. 126 waveform operating mode............................................................................... 128 tc user interface ............................................................................................. 131 tc block control register ................................................................................ 132 tc block mode register................................................................................... 133 tc channel control register............................................................................ 134 tc channel mode register: capture mode ..................................................... 135 tc channel mode register: waveform mode.................................................. 137 tc counter value register............................................................................... 141 tc register a ................................................................................................... 141 tc register b ................................................................................................... 142 tc register c ................................................................................................... 142 tc status register ........................................................................................... 143 tc interrupt enable register ............................................................................ 145 tc interrupt disable register ........................................................................... 146 tc interrupt mask register............................................................................... 147 table of contents .................................................................................. i
printed on recycled paper. ? atmel corporation 2002. atmel corporation makes no warranty for the use of its products, other than those expressly contained in the company ? s standard warranty whichisdetailedinatmel ? s terms and conditions located on the company ? s web site. the company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. no licenses to patents or other intellectual property of atmel are granted by the company in connection with the sale of atmel products, expressly or by implication. atmel ? s products are not authorized for use as critical components in life support devices or systems. atmel headquarters atmel operations corporate headquarters 2325 orchard parkway san jose, ca 95131 tel 1(408) 441-0311 fax 1(408) 487-2600 europe atmel sarl route des arsenaux 41 case postale 80 ch-1705 fribourg switzerland tel (41) 26-426-5555 fax (41) 26-426-5500 asia room 1219 chinachem golden plaza 77 mody road tsimhatsui east kowloon hong kong tel (852) 2721-9778 fax (852) 2722-1369 japan 9f, tonetsu shinkawa bldg. 1-24-8 shinkawa chuo-ku, tokyo 104-0033 japan tel (81) 3-3523-3551 fax (81) 3-3523-7581 memory 2325 orchard parkway san jose, ca 95131 tel 1(408) 441-0311 fax 1(408) 436-4314 microcontrollers 2325 orchard parkway san jose, ca 95131 tel 1(408) 441-0311 fax 1(408) 436-4314 la chantrerie bp 70602 44306 nantes cedex 3, france tel (33) 2-40-18-18-18 fax (33) 2-40-18-19-60 asic/assp/smart cards zone industrielle 13106 rousset cedex, france tel (33) 4-42-53-60-00 fax (33) 4-42-53-60-01 1150 east cheyenne mtn. blvd. colorado springs, co 80906 tel 1(719) 576-3300 fax 1(719) 540-1759 scottish enterprise technology park maxwell building east kilbride g75 0qr, scotland tel (44) 1355-803-000 fax (44) 1355-242-743 rf/automotive theresienstrasse 2 postfach 3535 74025 heilbronn, germany tel (49) 71-31-67-0 fax (49) 71-31-67-2340 1150 east cheyenne mtn. blvd. colorado springs, co 80906 tel 1(719) 576-3300 fax 1(719) 540-1759 biometrics/imaging/hi-rel mpu/ high speed converters/rf datacom avenue de rochepleine bp 123 38521 saint-egreve cedex, france tel (33) 4-76-58-30-00 fax (33) 4-76-58-34-80 e-mail literature@atmel.com web site http://www.atmel.com 1354d ? atarm ? 05/02 0m atmel ? is the registered trademark of atmel. arm ? ,thumb ? and arm powered ? are registered trademarks of arm ltd. arm7tdmi ? and amba ? are the trademarks of arm ltd. other terms and product names may be the trademarks of others.


▲Up To Search▲   

 
Price & Availability of AT91X40

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X